[Asterisk-code-review] res stasis: Fix app is subscribed bridge id. (asterisk[13])

Jenkins2 asteriskteam at digium.com
Mon Jan 8 11:13:22 CST 2018


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/7868 )

Change subject: res_stasis: Fix app_is_subscribed_bridge_id.
......................................................................

res_stasis: Fix app_is_subscribed_bridge_id.

Instead of searching for bridge_id provided in an argument this function
always searched for BRIDGE_ALL first.  Rewrite this function to work
like the similar functions for channel and endpoint functions.

Change-Id: Ib5caca69e11727c5c8a7284a1d00621f40f1e60a
---
M res/stasis/app.c
1 file changed, 3 insertions(+), 13 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Richard Mudgett: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/res/stasis/app.c b/res/stasis/app.c
index 5366819..91b0065 100644
--- a/res/stasis/app.c
+++ b/res/stasis/app.c
@@ -1432,25 +1432,15 @@
 int app_is_subscribed_bridge_id(struct stasis_app *app, const char *bridge_id)
 {
 	struct app_forwards *forwards;
-	SCOPED_AO2LOCK(lock, app->forwards);
-
-	forwards = ao2_find(app->forwards, BRIDGE_ALL, OBJ_SEARCH_KEY | OBJ_NOLOCK);
-	if (forwards) {
-		ao2_ref(forwards, -1);
-		return 1;
-	}
 
 	if (ast_strlen_zero(bridge_id)) {
 		bridge_id = BRIDGE_ALL;
 	}
 
-	forwards = ao2_find(app->forwards, bridge_id, OBJ_SEARCH_KEY | OBJ_NOLOCK);
-	if (forwards) {
-		ao2_ref(forwards, -1);
-		return 1;
-	}
+	forwards = ao2_find(app->forwards, bridge_id, OBJ_SEARCH_KEY);
+	ao2_cleanup(forwards);
 
-	return 0;
+	return forwards != NULL;
 }
 
 static void *bridge_find(const struct stasis_app *app, const char *id)

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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib5caca69e11727c5c8a7284a1d00621f40f1e60a
Gerrit-Change-Number: 7868
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180108/aee8322f/attachment-0001.html>


More information about the asterisk-code-review mailing list