[Asterisk-code-review] res/res stasis: Fix accidental subscription to 'all' bridge ... (asterisk[master])

Matt Jordan asteriskteam at digium.com
Sun Sep 27 20:51:20 CDT 2015


Matt Jordan has uploaded a new change for review.

  https://gerrit.asterisk.org/1331

Change subject: res/res_stasis: Fix accidental subscription to 'all' bridge topic
......................................................................

res/res_stasis: Fix accidental subscription to 'all' bridge topic

When b99a7052621700a1aa641a1c24308f5873275fc8 was merged, subscribing to a
NULL bridge will now cause app_subscribe_bridge to implicitly subscribe to
all bridges. Unfortunately, the res_stasis control loop did not check that
a bridge changing on a channel's control object was actually also non-NULL.
As a result, app_subscribe_bridge will be called with a NULL bridge when a
channel leaves a bridge. This causes a new subscription to be made to the
bridge. If an application has also subscribed to the bridge, the application
will now have two subscriptions:
(1) The explicit one created by the app
(2) The implicit one accidentally created by the control structure

As a result, the 'BridgeDestroyed' event can be sent multiple times. This
patch corrects the control loop such that it only subscribes an application
to a new bridge if the bridge pointer is non-NULL.

ASTERISK-24870

Change-Id: I3510e55f6bc36517c10597ead857b964463c9f4f
---
M res/res_stasis.c
1 file changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/31/1331/1

diff --git a/res/res_stasis.c b/res/res_stasis.c
index 69e9b93..abca895 100644
--- a/res/res_stasis.c
+++ b/res/res_stasis.c
@@ -1294,7 +1294,9 @@
 
 		if (bridge != last_bridge) {
 			app_unsubscribe_bridge(app, last_bridge);
-			app_subscribe_bridge(app, bridge);
+			if (bridge) {
+				app_subscribe_bridge(app, bridge);
+			}
 		}
 
 		if (bridge) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3510e55f6bc36517c10597ead857b964463c9f4f
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list