<p>laforge <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-mgw/+/24943">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">mgcp_client_endpoint_fsm: on term, still let conns wait for DLCX OK<br><br>When the mgcp_client_endpoint_fsm terminates, do not directly pull each<br>conn FSM instance (mgcp_client_fsm) into oblivion as well. Those should<br>emit a DLCX and wait for the "OK" response before deallocating.<br><br>In programs using the mgcp client endpoint FSM (osmo-bsc, osmo-msc),<br>this gets rid of false LMGCP ERROR logging related to DLCX like this:<br><br>  Cannot find matching MGCP transaction for trans_id 71998<br><br>Related: SYS#5529<br>Change-Id: I8fbfec5533e9be9cc7ea550df1e6639a0a215973<br>---<br>M src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c<br>1 file changed, 29 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c b/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c</span><br><span>index 7175c18..0613e17 100644</span><br><span>--- a/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c</span><br><span>+++ b/src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c</span><br><span>@@ -990,6 +990,34 @@</span><br><span>  return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+void osmo_mgcpc_ep_fsm_pre_term(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+      int i;</span><br><span style="color: hsl(120, 100%, 40%);">+        struct osmo_mgcpc_ep *ep = osmo_mgcpc_ep_fi_mgwep(fi);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      /* We want the mgcp_client_fsm to still stick around until it received the DLCX "OK" responses from the MGW. So</span><br><span style="color: hsl(120, 100%, 40%);">+      * it should not dealloc along with this ep_fsm instance. Instead, signal DLCX for each conn on the endpoint,</span><br><span style="color: hsl(120, 100%, 40%);">+  * and detach the mgcp_client_fsm from being a child-fsm.</span><br><span style="color: hsl(120, 100%, 40%);">+      *</span><br><span style="color: hsl(120, 100%, 40%);">+     * After mgcp_conn_delete(), an mgcp_client_fsm instance goes into ST_DLCX_RESP, which waits up to 4 seconds for</span><br><span style="color: hsl(120, 100%, 40%);">+       * a DLCX OK. If none is received in that time, the instance terminates. So cleanup of the instance is</span><br><span style="color: hsl(120, 100%, 40%);">+         * guaranteed. */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   for (i = 0; i < ARRAY_SIZE(ep->ci); i++) {</span><br><span style="color: hsl(120, 100%, 40%);">+              struct osmo_mgcpc_ep_ci *ci = &ep->ci[i];</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+            if (!ci->occupied || !ci->mgcp_client_fi)</span><br><span style="color: hsl(120, 100%, 40%);">+                       continue;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+           /* mgcp_conn_delete() unlinks itself from this parent FSM implicitly and waits for the DLCX OK. */</span><br><span style="color: hsl(120, 100%, 40%);">+            mgcp_conn_delete(ci->mgcp_client_fi);</span><br><span style="color: hsl(120, 100%, 40%);">+              /* Forget all about this ci */</span><br><span style="color: hsl(120, 100%, 40%);">+                *ci = (struct osmo_mgcpc_ep_ci){</span><br><span style="color: hsl(120, 100%, 40%);">+                      .ep = ep,</span><br><span style="color: hsl(120, 100%, 40%);">+             };</span><br><span style="color: hsl(120, 100%, 40%);">+    }</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static struct osmo_fsm osmo_mgcpc_ep_fsm = {</span><br><span>       .name = "mgw-endp",</span><br><span>        .states = osmo_mgcpc_ep_fsm_states,</span><br><span>@@ -997,5 +1025,5 @@</span><br><span>   .log_subsys = DLMGCP,</span><br><span>        .event_names = osmo_mgcpc_ep_fsm_event_names,</span><br><span>        .timer_cb = osmo_mgcpc_ep_fsm_timer_cb,</span><br><span style="color: hsl(0, 100%, 40%);">- /* The FSM termination will automatically trigger any mgcp_client_fsm instances to DLCX. */</span><br><span style="color: hsl(120, 100%, 40%);">+   .pre_term = osmo_mgcpc_ep_fsm_pre_term,</span><br><span> };</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-mgw/+/24943">change 24943</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-mgw/+/24943"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-mgw </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I8fbfec5533e9be9cc7ea550df1e6639a0a215973 </div>
<div style="display:none"> Gerrit-Change-Number: 24943 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>