[Asterisk-code-review] app_queue: Fix hint updates, allow dup. hints (asterisk[19])

Friendly Automation asteriskteam at digium.com
Wed Jan 5 08:11:27 CST 2022


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

Change subject: app_queue: Fix hint updates, allow dup. hints
......................................................................

app_queue: Fix hint updates, allow dup. hints

A previous patch for ASTERISK_29578 caused a 'leak' of
extension state information across queues, causing the
state of the first member of unrelated queues to be
updated in addition to the correct member. Which queues
and members depended on the order of queues in the
iterator.

Additionally, it is possible to use the same 'hint:' on
multiple queue members, so the update cannot break out
of the update loop early when a match is found.

ASTERISK-29806 #close

Change-Id: If2c1d1cc2a752afd9286d79710fc818596e7a7ad
---
M apps/app_queue.c
1 file changed, 2 insertions(+), 7 deletions(-)

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



diff --git a/apps/app_queue.c b/apps/app_queue.c
index d03d9f0..ddfa729 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2708,16 +2708,11 @@
 
 		miter = ao2_iterator_init(q->members, 0);
 		for (; (m = ao2_iterator_next(&miter)); ao2_ref(m, -1)) {
-			if (!strcmp(m->state_context, context) && !strcmp(m->state_exten, exten)) {
-				found = 1;
-			} else if (!strcmp(m->state_exten, exten) && context_included(m->state_context, context)) {
+			if (!strcmp(m->state_exten, exten) &&
+				(!strcmp(m->state_context, context) || context_included(m->state_context, context))) {
 				/* context could be included in m->state_context. We need to check. */
 				found = 1;
-			}
-			if (found) {
 				update_status(q, m, device_state);
-				ao2_ref(m, -1);
-				break;
 			}
 		}
 		ao2_iterator_destroy(&miter);

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

Gerrit-Project: asterisk
Gerrit-Branch: 19
Gerrit-Change-Id: If2c1d1cc2a752afd9286d79710fc818596e7a7ad
Gerrit-Change-Number: 17736
Gerrit-PatchSet: 2
Gerrit-Owner: Sean Bright <sean at seanbright.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-CC: Steve Davies <steve at one47.co.uk>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220105/29d5c571/attachment.html>


More information about the asterisk-code-review mailing list