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

Sean Bright asteriskteam at digium.com
Wed Dec 22 14:02:15 CST 2021


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/17737 )


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(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/37/17737/1

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/+/17737
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: If2c1d1cc2a752afd9286d79710fc818596e7a7ad
Gerrit-Change-Number: 17737
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean at seanbright.com>
Gerrit-CC: Steve Davies <steve at one47.co.uk>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20211222/6b936b5e/attachment-0001.html>


More information about the asterisk-code-review mailing list