diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2022-10-19 18:19:43 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2022-10-19 18:19:43 +0200 |
commit | 29aab8a0619e4312868c24988c6ed26b447178b1 (patch) | |
tree | eed18a1a3c18fc43049718ccdc3fab86e0e269c4 | |
parent | d9d0032fff84d9a874ac948430c9f364ba3ab819 (diff) |
WIPpespin/foo
Change-Id: I570ec3848f5cee98fe16a0ba7799c8551067a3ac
-rw-r--r-- | src/libmsc/call_leg.c | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/src/libmsc/call_leg.c b/src/libmsc/call_leg.c index 67eb4ce1e..03c988205 100644 --- a/src/libmsc/call_leg.c +++ b/src/libmsc/call_leg.c @@ -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); } @@ -202,11 +208,6 @@ static void call_leg_fsm_releasing(struct osmo_fsm_inst *fi, uint32_t event, voi break; case CALL_LEG_EV_MGW_ENDPOINT_GONE: - /* This is actually never received, because we called osmo_fsm_inst_term() - * at oneneter(): - * "FSM instance already terminating, not dispatching event CALL_LEG_EV_MGW_ENDPOINT_GONE" - * In this scenario, we end up releasing the mgw_endpoint through cleanup() cb. - */ call_leg_mgw_endpoint_gone(cl); break; @@ -215,19 +216,6 @@ static void call_leg_fsm_releasing(struct osmo_fsm_inst *fi, uint32_t event, voi } } -static void call_leg_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause) -{ - struct call_leg *cl = fi->priv; - struct mgcp_client *mgcp_client; - - if (cl->mgw_endpoint) { - /* Put MGCP client back into MGW pool */ - mgcp_client = osmo_mgcpc_ep_client(cl->mgw_endpoint); - mgcp_client_pool_put(mgcp_client); - cl->mgw_endpoint = NULL; - } -} - static const struct value_string call_leg_fsm_event_names[] = { OSMO_VALUE_STRING(CALL_LEG_EV_RTP_STREAM_ADDR_AVAILABLE), OSMO_VALUE_STRING(CALL_LEG_EV_RTP_STREAM_ESTABLISHED), @@ -286,7 +274,6 @@ static struct osmo_fsm call_leg_fsm = { .log_subsys = DCC, .event_names = call_leg_fsm_event_names, .timer_cb = call_leg_fsm_timer_cb, - .cleanup = call_leg_fsm_cleanup, }; const struct value_string rtp_direction_names[] = { |