<p>neels has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-mgw/+/15837">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">clear pending requests on MGCP failure<br><br>If an MGCP operation on one conn of an endpoint fails, no longer carry out<br>other pending requests for that endpoint. Only allow pending DLCX to be sent.<br><br>If the caller schedules two CRCX at the same time, the first CRCX is sent with<br>a wildcarded endpoint name like "rtpbridge/*@mgw". Only when the OK for that<br>returns an allocated endpoint, will the second CRCX be sent, using that actual<br>allocated endpoint name. But, if the first CRCX fails, then we should not send<br>another wildcard CRCX, but rather assume both as failed.<br><br>Since a failed MGCP message means that the endpoint becomes unusable /<br>undefined and typically deallocates directly, we can actually discard all other<br>pending requests except for DLCX.<br><br>Change-Id: Icb1d485224bb486b84eff6329f0bd95932e63246<br>---<br>M src/libosmo-mgcp-client/mgcp_client_endpoint_fsm.c<br>1 file changed, 20 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/37/15837/1</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 420fc0f..3ea1492 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>@@ -357,6 +357,8 @@</span><br><span>       struct osmo_fsm_inst *notify = ci->notify;</span><br><span>        uint32_t notify_failure = ci->notify_failure;</span><br><span>     void *notify_data = ci->notify_data;</span><br><span style="color: hsl(120, 100%, 40%);">+       struct osmo_mgcpc_ep *ep = ci->ep;</span><br><span style="color: hsl(120, 100%, 40%);">+ int i;</span><br><span> </span><br><span>   if (!ci->occupied)</span><br><span>                return;</span><br><span>@@ -365,6 +367,24 @@</span><br><span>               .ep = ci->ep,</span><br><span>     };</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+        /* An MGCP failure typically means the endpoint becomes unusable, cancel all pending request (except DLCX).</span><br><span style="color: hsl(120, 100%, 40%);">+    * Particularly, if two CRCX were scheduled and the first fails, we must no longer dispatch the second CRCX. */</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 *other_ci = &ep->ci[i];</span><br><span style="color: hsl(120, 100%, 40%);">+                if (other_ci == ci)</span><br><span style="color: hsl(120, 100%, 40%);">+                   continue;</span><br><span style="color: hsl(120, 100%, 40%);">+             if (!other_ci->occupied)</span><br><span style="color: hsl(120, 100%, 40%);">+                   continue;</span><br><span style="color: hsl(120, 100%, 40%);">+             if (!other_ci->pending)</span><br><span style="color: hsl(120, 100%, 40%);">+                    continue;</span><br><span style="color: hsl(120, 100%, 40%);">+             if (other_ci->sent)</span><br><span style="color: hsl(120, 100%, 40%);">+                        continue;</span><br><span style="color: hsl(120, 100%, 40%);">+             if (other_ci->verb == MGCP_VERB_DLCX)</span><br><span style="color: hsl(120, 100%, 40%);">+                      continue;</span><br><span style="color: hsl(120, 100%, 40%);">+             /* Just clear the pending request, don't fire more events than below. */</span><br><span style="color: hsl(120, 100%, 40%);">+          other_ci->pending = false;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>  /* If this check has terminated the FSM instance, don't fire any more events to prevent use-after-free problems.</span><br><span>          * The endpoint FSM does dispatch a term event to its parent, and everything should be cleaned like that. */</span><br><span>         if (!osmo_mgcpc_ep_fsm_check_state_chg_after_response(ci->ep->fi))</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-mgw/+/15837">change 15837</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/+/15837"/><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: Icb1d485224bb486b84eff6329f0bd95932e63246 </div>
<div style="display:none"> Gerrit-Change-Number: 15837 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>