<p>George Joseph <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13696">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved; Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_stasis: trigger cleanup after update<br><br>The cleanup code in stasis shuts down applications if they are in a deactivated<br>state, and no longer have explicit subscriptions. When registering an app the<br>cleanup code was running before calling 'update'. When it should be executed<br>after 'update' since a call to register may re-activate the app. We don't want<br>it to shutdown before the 'update' otherwise the app won't be re-activated,<br>or registered.<br><br>This patch makes it so the cleanup code is executed post 'update'.<br><br>ASTERISK-28679 #close<br><br>Change-Id: I8f2c0b17e33bb8128441567b97fd4c7bf74a327b<br>---<br>M res/res_stasis.c<br>1 file changed, 4 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_stasis.c b/res/res_stasis.c</span><br><span>index a8cc14c..8559658 100644</span><br><span>--- a/res/res_stasis.c</span><br><span>+++ b/res/res_stasis.c</span><br><span>@@ -1688,12 +1688,11 @@</span><br><span>       if (app) {</span><br><span>           /*</span><br><span>            * We need to unlock the apps_registry before calling app_update to</span><br><span style="color: hsl(0, 100%, 40%);">-              * prevent the possibility of a deadlock with the session.  We'll still</span><br><span style="color: hsl(0, 100%, 40%);">-              * run the lazy cleanup first though.</span><br><span style="color: hsl(120, 100%, 40%);">+          * prevent the possibility of a deadlock with the session.</span><br><span>            */</span><br><span style="color: hsl(0, 100%, 40%);">-             cleanup();</span><br><span>           ao2_unlock(apps_registry);</span><br><span>           app_update(app, handler, data);</span><br><span style="color: hsl(120, 100%, 40%);">+               cleanup();</span><br><span>           return 0;</span><br><span>    }</span><br><span> </span><br><span>@@ -1718,11 +1717,12 @@</span><br><span>      }</span><br><span>    ao2_link_flags(apps_registry, app, OBJ_NOLOCK);</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+   ao2_unlock(apps_registry);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>         /* We lazily clean up the apps_registry, because it's good enough to</span><br><span>      * prevent memory leaks, and we're lazy.</span><br><span>          */</span><br><span>  cleanup();</span><br><span style="color: hsl(0, 100%, 40%);">-      ao2_unlock(apps_registry);</span><br><span>   return 0;</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13696">change 13696</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.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.asterisk.org/c/asterisk/+/13696"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-Change-Id: I8f2c0b17e33bb8128441567b97fd4c7bf74a327b </div>
<div style="display:none"> Gerrit-Change-Number: 13696 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>