call_leg: Fix EV_MGW_ENDPOINT_GONE not processed in RELEASE state

Since call_leg_fsm_releasing_onenter() calls immediatelly
osmo_fsm_inst_term(), it meant we couldn't receive any event in that
state because osmo_fsm disables event dispatching to FSMs being
terminated.
As a result, CALL_LEG_EV_MGW_ENDPOINT_GONE was never received and hence
call_leg_mgw_endpoint_gone() was never called, which means the
mgcp_client used in cl->mgw_endpoint was never put back to the pool.

By first freeing all the children (rtp_streams), we make sure
cl->mgw_endpoint ends up with no conns and sends us the GONE event
before we go ourselves into termination state.

Related: SYS#5987
Change-Id: I2126578c4e64c9f336e8a1f6ee98de970866b8dc
This commit is contained in:
Pau Espin 2022-10-19 16:56:43 +02:00
parent ef70bb202a
commit 8bd13ff3df
1 changed files with 6 additions and 0 deletions

View File

@ -188,6 +188,12 @@ void call_leg_fsm_established_onenter(struct osmo_fsm_inst *fi, uint32_t prev_st
void call_leg_fsm_releasing_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
{
/* Trigger termination of children FSMs (rtp_stream(s)) before
* terminating ourselves, otherwise we are not able to receive
* CALL_LEG_EV_MGW_ENDPOINT_GONE from cl->mgw_endpoint (call_leg =>
* rtp_stream => mgw_endpoint), because osmo_fsm disabled dispatching
* events to an FSM in process of terminating. */
osmo_fsm_inst_term_children(fi, OSMO_FSM_TERM_PARENT, NULL);
osmo_fsm_inst_term(fi, OSMO_FSM_TERM_REGULAR, NULL);
}