diff options
author | Stefan Sperling <ssperling@sysmocom.de> | 2018-04-10 16:36:54 +0200 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2018-04-11 16:53:05 +0000 |
commit | ea33341cf7b52d432be98f2280b4a5f3129ef667 (patch) | |
tree | 702489b4448a1dab018cc3f7990aef415fdb06de /src/libbsc/bsc_vty.c | |
parent | 881836a7707a05b0871c73c50ad48f591043d07e (diff) |
ensure that acc_ramp_init() is only called once
There are plans to register signal handlers in acc_ramp_init(). Once we
do that, the acc_ramp_init() function should only be called once to
avoid duplicate signal handlers on the handler list.
However, the acc_ramp_init() function currently serves a dual-purpose:
1) Initialize the acc_ramp structure for a bts
2) Enable or disable ACC ramping
Add new functions to support use case 2, and call acc_ramp_init()
just once while reading the configuration file. The VTY commands
which enable/disable ACC ramping use the new APIs instead.
Also, rename acc_ramp_start() to acc_ramp_trigger() and tweak its
semantics so that it can always be called regardless of what the
current configuration settings are. This prepares us for triggering
ACC ramping upon events other than "RSL link-up".
Change-Id: Ia25bff85d9e5c277da76bffa11d31972e9fdc323
Related: OS2591
Diffstat (limited to 'src/libbsc/bsc_vty.c')
-rw-r--r-- | src/libbsc/bsc_vty.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libbsc/bsc_vty.c b/src/libbsc/bsc_vty.c index 13e123bf1..521a36a2f 100644 --- a/src/libbsc/bsc_vty.c +++ b/src/libbsc/bsc_vty.c @@ -1915,7 +1915,7 @@ DEFUN(cfg_bts, * Initalize bts->acc_ramp here. Else we could segfault while * processing a configuration file with ACC ramping settings. */ - acc_ramp_init(&bts->acc_ramp, false, bts); + acc_ramp_init(&bts->acc_ramp, bts); } else bts = gsm_bts_num(gsmnet, bts_nr); @@ -3275,7 +3275,8 @@ DEFUN(cfg_bts_acc_ramping, { struct gsm_bts *bts = vty->index; - acc_ramp_init(&bts->acc_ramp, true, bts); + if (!acc_ramp_is_enabled(&bts->acc_ramp)) + acc_ramp_set_enabled(&bts->acc_ramp, true); /* ACC ramping takes effect when the BTS reconnects. */ return CMD_SUCCESS; @@ -3290,7 +3291,7 @@ DEFUN(cfg_bts_no_acc_ramping, cfg_bts_no_acc_ramping_cmd, if (acc_ramp_is_enabled(&bts->acc_ramp)) { acc_ramp_abort(&bts->acc_ramp); - acc_ramp_init(&bts->acc_ramp, false, bts); + acc_ramp_set_enabled(&bts->acc_ramp, false); gsm_bts_set_system_infos(bts); } |