Change in osmo-mgw[master]: mgcp_client_endpoint_fsm: on term, still let conns wait for DLCX OK

neels gerrit-no-reply at lists.osmocom.org
Thu Jul 15 00:16:07 UTC 2021


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/24943 )


Change subject: mgcp_client_endpoint_fsm: on term, still let conns wait for DLCX OK
......................................................................

mgcp_client_endpoint_fsm: on term, still let conns wait for DLCX OK

When the mgcp_client_endpoint_fsm terminates, do not directly pull each
conn FSM instance (mgcp_client_fsm) into oblivion as well. Those should
emit a DLCX and wait for the "OK" response before deallocating.

In programs using the mgcp client endpoint FSM (osmo-bsc, osmo-msc),
this gets rid of false LMGCP ERROR logging related to DLCX like this:

  Cannot find matching MGCP transaction for trans_id 71998

Related: SYS#5529
Change-Id: I8fbfec5533e9be9cc7ea550df1e6639a0a215973
---
M src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c
1 file changed, 26 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/43/24943/1

diff --git a/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c b/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c
index 7175c18..375ea46 100644
--- a/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c
+++ b/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c
@@ -990,6 +990,31 @@
 	return 0;
 }
 
+void osmo_mgcpc_ep_fsm_pre_term(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause)
+{
+	int i;
+	struct osmo_mgcpc_ep *ep = osmo_mgcpc_ep_fi_mgwep(fi);
+
+	/* We want the mgcp_client_fsm to still stick around until it received the DLCX "OK" responses from the MGW. So
+	 * it should not dealloc along with this ep_fsm instance. Instead, signal DLCX for each conn on the endpoint,
+	 * and detach the mgcp_client_fsm from being a child-fsm.
+	 *
+	 * After mgcp_conn_delete(), an mgcp_client_fsm instance goes into ST_DLCX_RESP, which waits up to 4 seconds for
+	 * a DLCX OK. If none is received in that time, the instance terminates. So cleanup of the instance is
+	 * guaranteed. */
+
+	for (i = 0; i < ARRAY_SIZE(ep->ci); i++) {
+		struct osmo_mgcpc_ep_ci *ci = &ep->ci[i];
+
+		if (!ci->occupied || !ci->mgcp_client_fi)
+			continue;
+
+		mgcp_conn_delete(ci->mgcp_client_fi);
+		osmo_fsm_inst_unlink_parent(ci->mgcp_client_fi, ci->ep->mgcp_client);
+		ci->mgcp_client_fi = NULL;
+	}
+}
+
 static struct osmo_fsm osmo_mgcpc_ep_fsm = {
 	.name = "mgw-endp",
 	.states = osmo_mgcpc_ep_fsm_states,
@@ -997,5 +1022,5 @@
 	.log_subsys = DLMGCP,
 	.event_names = osmo_mgcpc_ep_fsm_event_names,
 	.timer_cb = osmo_mgcpc_ep_fsm_timer_cb,
-	/* The FSM termination will automatically trigger any mgcp_client_fsm instances to DLCX. */
+	.pre_term = osmo_mgcpc_ep_fsm_pre_term,
 };

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/24943
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I8fbfec5533e9be9cc7ea550df1e6639a0a215973
Gerrit-Change-Number: 24943
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210715/213788c0/attachment.htm>


More information about the gerrit-log mailing list