[Asterisk-code-review] res stasis: Don't unsubscribe from a NULL bridge. (asterisk[master])

Joshua Colp asteriskteam at digium.com
Tue Nov 8 04:59:24 CST 2016


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/4336 )

Change subject: res_stasis: Don't unsubscribe from a NULL bridge.
......................................................................


res_stasis: Don't unsubscribe from a NULL bridge.

A NULL bridge has special meaning in res_stasis for
unsubscribing. It means that a subscription to ALL
bridges should be removed. This should not be done
as part of the normal subscription management in
the res_stasis channel loop.

ASTERISK-26468

Change-Id: I6d5bea8246dd13a22ef86b736aefbf2a39c15af0
---
M res/res_stasis.c
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/res/res_stasis.c b/res/res_stasis.c
index f3d940e..e77cdb0 100644
--- a/res/res_stasis.c
+++ b/res/res_stasis.c
@@ -1327,7 +1327,9 @@
 		bridge = ao2_bump(stasis_app_get_bridge(control));
 
 		if (bridge != last_bridge) {
-			app_unsubscribe_bridge(app, last_bridge);
+			if (last_bridge) {
+				app_unsubscribe_bridge(app, last_bridge);
+			}
 			if (bridge) {
 				app_subscribe_bridge(app, bridge);
 			}
@@ -1388,7 +1390,9 @@
 		ast_bridge_depart(chan);
 	}
 
-	app_unsubscribe_bridge(app, stasis_app_get_bridge(control));
+	if (stasis_app_get_bridge(control)) {
+		app_unsubscribe_bridge(app, stasis_app_get_bridge(control));
+	}
 	ao2_cleanup(bridge);
 
 	/* Only publish a stasis_end event if it hasn't already been published */

-- 
To view, visit https://gerrit.asterisk.org/4336
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I6d5bea8246dd13a22ef86b736aefbf2a39c15af0
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-code-review mailing list