diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-12-06 19:09:58 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2012-12-23 20:18:18 +0100 |
commit | 93599a2c2c2a673ff3f19031850565050b4eb02c (patch) | |
tree | f7008300c14a0938c6221d1c24fe1d2a15f74a21 /openbsc/src/libbsc/abis_rsl.c | |
parent | d66777f9cfc5b74253b1b163e2d8dc32e8f50ef9 (diff) |
rsl: Cosmetic changes to the release code
Put the idiom that sets the lchan state to none and respecting the
error state into a shared method. This way the special handling for
the abnormal case is just in one place.
Diffstat (limited to 'openbsc/src/libbsc/abis_rsl.c')
-rw-r--r-- | openbsc/src/libbsc/abis_rsl.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c index 95d5c1ea7..6f50cee16 100644 --- a/openbsc/src/libbsc/abis_rsl.c +++ b/openbsc/src/libbsc/abis_rsl.c @@ -56,6 +56,14 @@ static void send_lchan_signal(int sig_no, struct gsm_lchan *lchan, osmo_signal_dispatch(SS_LCHAN, sig_no, &sig); } +static void do_lchan_free(struct gsm_lchan *lchan) +{ + /* we have an error timer pending to release that */ + if (lchan->state != LCHAN_S_REL_ERR) + rsl_lchan_set_state(lchan, LCHAN_S_NONE); + lchan_free(lchan); +} + static uint8_t mdisc_by_msgtype(uint8_t msg_type) { /* mask off the transparent bit ? */ @@ -196,9 +204,7 @@ static void lchan_deact_tmr_cb(void *data) LOGP(DRSL, LOGL_ERROR, "%s Timeout during deactivation!\n", gsm_lchan_name(lchan)); - if (lchan->state != LCHAN_S_REL_ERR) - rsl_lchan_set_state(lchan, LCHAN_S_NONE); - lchan_free(lchan); + do_lchan_free(lchan); } @@ -696,17 +702,15 @@ static int rsl_rx_rf_chan_rel_ack(struct gsm_lchan *lchan) DEBUGP(DRSL, "%s RF CHANNEL RELEASE ACK\n", gsm_lchan_name(lchan)); + /* Stop all pending timers */ osmo_timer_del(&lchan->act_timer); + osmo_timer_del(&lchan->T3111); if (lchan->state != LCHAN_S_REL_REQ && lchan->state != LCHAN_S_REL_ERR) LOGP(DRSL, LOGL_NOTICE, "%s CHAN REL ACK but state %s\n", gsm_lchan_name(lchan), gsm_lchans_name(lchan->state)); - osmo_timer_del(&lchan->T3111); - /* we have an error timer pending to release that */ - if (lchan->state != LCHAN_S_REL_ERR) - rsl_lchan_set_state(lchan, LCHAN_S_NONE); - lchan_free(lchan); + do_lchan_free(lchan); return 0; } |