fixeria has uploaded this change for review.

View Change

lchan_fsm: ignore late lchan_rtp_fsm events

The lchan_rtp_fsm is a child FSM that manages the MGW/RTP endpoint.
When the parent lchan_fsm transitions away before the child has
finished its work (e.g. a CRCX timeout or a DLCX completing after
the lchan is already idle), the child can still deliver
LCHAN_EV_RTP_RELEASED or LCHAN_EV_RTP_ERROR to the parent.

Currently these late events are not in the in_event_mask of every
state that can be reached with the child still running:

* LCHAN_ST_UNUSED: entered from WAIT_AFTER_ERROR after the error timer
fires, while a DLCX triggered at error time may still be in flight.
* LCHAN_ST_WAIT_AFTER_ERROR: already handles LCHAN_EV_RTP_RELEASED but
misses LCHAN_EV_RTP_ERROR (e.g. CRCX timeout arriving after the
NACK was handled).

Add the missing events to both states' in_event_mask and provide a
no-op handler in lchan_fsm_unused() so that the assert is not hit.

Change-Id: Ie6333bd941e4e5a6ddf0e3f113b8764e8bc2bbc0
---
M src/osmo-bsc/lchan_fsm.c
1 file changed, 8 insertions(+), 0 deletions(-)

git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/91/42591/1
diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index 55875f0..524d66e 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -736,6 +736,11 @@
lchan_fsm_state_chg(LCHAN_ST_WAIT_TS_READY);
break;

+ case LCHAN_EV_RTP_RELEASED:
+ case LCHAN_EV_RTP_ERROR:
+ /* Ignore late lchan_rtp_fsm events arriving after the lchan is back to UNUSED. */
+ break;
+
default:
OSMO_ASSERT(false);
}
@@ -1710,6 +1715,8 @@
.action = lchan_fsm_unused,
.in_event_mask = 0
| S(LCHAN_EV_ACTIVATE)
+ | S(LCHAN_EV_RTP_RELEASED) /* ignore late lchan_rtp_fsm release events */
+ | S(LCHAN_EV_RTP_ERROR) /* ignore late lchan_rtp_fsm error events */
,
.out_state_mask = 0
| S(LCHAN_ST_WAIT_TS_READY)
@@ -1869,6 +1876,7 @@
.onenter = lchan_fsm_wait_after_error_onenter,
.in_event_mask = 0
| S(LCHAN_EV_RTP_RELEASED) /* ignore late lchan_rtp_fsm release events */
+ | S(LCHAN_EV_RTP_ERROR) /* ignore late lchan_rtp_fsm error events */
,
.out_state_mask = 0
| S(LCHAN_ST_UNUSED)

To view, visit change 42591. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ie6333bd941e4e5a6ddf0e3f113b8764e8bc2bbc0
Gerrit-Change-Number: 42591
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de>