diff options
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/abis.c | 8 | ||||
-rw-r--r-- | src/common/bts.c | 21 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/common/abis.c b/src/common/abis.c index 79a9d4d0..c1e1c4f3 100644 --- a/src/common/abis.c +++ b/src/common/abis.c @@ -513,5 +513,13 @@ void abis_close(struct ipabis_link *link) if (osmo_timer_pending(&link->timer)) osmo_timer_del(&link->timer); + + /* for now, we simply terminate the program and re-spawn */ + if (link->bts) + bts_shutdown(link->bts); + else if (link->trx) + bts_shutdown(link->trx->bts); + else + exit(43); } diff --git a/src/common/bts.c b/src/common/bts.c index 02cb0fe1..19a3e430 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -56,6 +56,27 @@ int bts_init(struct gsm_bts *bts) return bts_model_init(bts); } +static void shutdown_timer_cb(void *data) +{ + exit(42); +} + +static struct osmo_timer_list shutdown_timer = { + .cb = &shutdown_timer_cb, +}; + +void bts_shutdown(struct gsm_bts *bts) +{ + struct gsm_bts_trx *trx; + + llist_for_each_entry(trx, &bts->trx_list, list) + bts_model_trx_deact_rf(trx); + + /* shedule a timer to make sure select loop logic can run again + * to dispatch any pending primitives */ + osmo_timer_schedule(&shutdown_timer, 3, 0); +} + #if 0 struct osmobts_lchan *lchan_by_channelnr(struct osmobts_trx *trx, uint8_t channelnr) |