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

laforge gerrit-no-reply at lists.osmocom.org
Fri Jul 16 15:58:17 UTC 2021


laforge has submitted this change. ( 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, 29 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c b/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c
index 7175c18..0613e17 100644
--- a/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c
+++ b/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c
@@ -990,6 +990,34 @@
 	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() unlinks itself from this parent FSM implicitly and waits for the DLCX OK. */
+		mgcp_conn_delete(ci->mgcp_client_fi);
+		/* Forget all about this ci */
+		*ci = (struct osmo_mgcpc_ep_ci){
+			.ep = ep,
+		};
+	}
+}
+
 static struct osmo_fsm osmo_mgcpc_ep_fsm = {
 	.name = "mgw-endp",
 	.states = osmo_mgcpc_ep_fsm_states,
@@ -997,5 +1025,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: 2
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210716/97b61073/attachment.htm>


More information about the gerrit-log mailing list