From cda317f842f838666daed0e984f27b172b3fc444 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Tue, 6 Nov 2018 22:24:59 +0100 Subject: lchan: release in error: fix missing messages / events In the case where there is a release in error and we skip immediately to the RF Release state, send all of Deact SACCH, RR Release messages and also signal the lchan_rtp_fsm as appropriate. Move that code to static lchan_do_release() and call from both lchan_fsm_wait_rll_rtp_released_onenter() in the normal case, as well as lchan_release() when skipping that. When releasing in error, but we're already in LCHAN_ST_WAIT_RLL_RTP_RELEASED, those messages have already been sent and we can skip them. Change-Id: I648a9826ce56b611359f81462ca03e4ab4c736aa --- src/osmo-bsc/lchan_fsm.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c index 39f29f2f7..f43264410 100644 --- a/src/osmo-bsc/lchan_fsm.c +++ b/src/osmo-bsc/lchan_fsm.c @@ -927,6 +927,18 @@ static bool should_sacch_deact(struct gsm_lchan *lchan) } } +static void lchan_do_release(struct gsm_lchan *lchan) +{ + if (lchan->do_rr_release && lchan->sapis[0] != LCHAN_SAPI_UNUSED) + gsm48_send_rr_release(lchan); + + if (lchan->fi_rtp) + osmo_fsm_inst_dispatch(lchan->fi_rtp, LCHAN_RTP_EV_RELEASE, 0); + + if (lchan->deact_sacch && should_sacch_deact(lchan)) + rsl_deact_sacch(lchan); +} + static void lchan_fsm_wait_rll_rtp_released_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state) { int sapis; @@ -937,14 +949,7 @@ static void lchan_fsm_wait_rll_rtp_released_onenter(struct osmo_fsm_inst *fi, ui if (lchan->sapis[sapi]) LOG_LCHAN(lchan, LOGL_DEBUG, "SAPI[%d] = %d\n", sapi, lchan->sapis[sapi]); - if (lchan->do_rr_release && lchan->sapis[0] != LCHAN_SAPI_UNUSED) - gsm48_send_rr_release(lchan); - - if (lchan->fi_rtp) - osmo_fsm_inst_dispatch(lchan->fi_rtp, LCHAN_RTP_EV_RELEASE, 0); - - if (lchan->deact_sacch && should_sacch_deact(lchan)) - rsl_deact_sacch(lchan); + lchan_do_release(lchan); sapis = 0; for_each_active_sapi(sapi, 1, lchan) { @@ -1319,10 +1324,11 @@ void lchan_release(struct gsm_lchan *lchan, bool sacch_deact, bool do_rr_release if (lchan->release_in_error) { switch (lchan->fi->state) { default: - /* Normally we deact SACCH in lchan_fsm_wait_rll_rtp_released_onenter(). When - * skipping that, but asked to SACCH deact, do it now. */ - if (lchan->deact_sacch) - rsl_deact_sacch(lchan); + /* Normally we signal release in lchan_fsm_wait_rll_rtp_released_onenter(). When + * skipping that, do it now. */ + lchan_do_release(lchan); + /* fall thru */ + case LCHAN_ST_WAIT_RLL_RTP_RELEASED: lchan_fsm_state_chg(LCHAN_ST_WAIT_RF_RELEASE_ACK); goto exit_release_handler; case LCHAN_ST_WAIT_TS_READY: -- cgit v1.2.3