[Asterisk-code-review] res_stasis: trigger cleanup after update (asterisk[16])

Friendly Automation asteriskteam at digium.com
Thu Jan 30 10:02:22 CST 2020


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/13675 )

Change subject: res_stasis: trigger cleanup after update
......................................................................

res_stasis: trigger cleanup after update

The cleanup code in stasis shuts down applications if they are in a deactivated
state, and no longer have explicit subscriptions. When registering an app the
cleanup code was running before calling 'update'. When it should be executed
after 'update' since a call to register may re-activate the app. We don't want
it to shutdown before the 'update' otherwise the app won't be re-activated,
or registered.

This patch makes it so the cleanup code is executed post 'update'.

ASTERISK-28679 #close

Change-Id: I8f2c0b17e33bb8128441567b97fd4c7bf74a327b
---
M res/res_stasis.c
1 file changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/res/res_stasis.c b/res/res_stasis.c
index 04b10ef..95fd108 100644
--- a/res/res_stasis.c
+++ b/res/res_stasis.c
@@ -1715,12 +1715,11 @@
 	if (app) {
 		/*
 		 * We need to unlock the apps_registry before calling app_update to
-		 * prevent the possibility of a deadlock with the session.  We'll still
-		 * run the lazy cleanup first though.
+		 * prevent the possibility of a deadlock with the session.
 		 */
-		cleanup();
 		ao2_unlock(apps_registry);
 		app_update(app, handler, data);
+		cleanup();
 		return 0;
 	}
 
@@ -1745,11 +1744,12 @@
 	}
 	ao2_link_flags(apps_registry, app, OBJ_NOLOCK);
 
+	ao2_unlock(apps_registry);
+
 	/* We lazily clean up the apps_registry, because it's good enough to
 	 * prevent memory leaks, and we're lazy.
 	 */
 	cleanup();
-	ao2_unlock(apps_registry);
 	return 0;
 }
 

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13675
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: I8f2c0b17e33bb8128441567b97fd4c7bf74a327b
Gerrit-Change-Number: 13675
Gerrit-PatchSet: 2
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200130/ac81e6eb/attachment-0001.html>


More information about the asterisk-code-review mailing list