Fix release of mgcp-cli endpoint

Change-Id: I2126578c4e64c9f336e8a1f6ee98de970866b8dc
This commit is contained in:
Pau Espin 2022-10-19 16:56:43 +02:00
parent 891bd83b8c
commit d9d0032fff
1 changed files with 19 additions and 0 deletions

View File

@ -202,6 +202,11 @@ 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;
@ -210,6 +215,19 @@ 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),
@ -268,6 +286,7 @@ 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[] = {