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

Joshua Colp asteriskteam at digium.com
Wed Jan 5 08:07:58 CST 2022


Joshua Colp has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/17658 )

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; Approved for Submit
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved



diff --git a/apps/app_queue.c b/apps/app_queue.c
index dcd5aa8..c7fc26e 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2711,16 +2711,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/+/17658
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: If2c1d1cc2a752afd9286d79710fc818596e7a7ad
Gerrit-Change-Number: 17658
Gerrit-PatchSet: 4
Gerrit-Owner: Steve Davies <steve at one47.co.uk>
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-Reviewer: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220105/f85a1733/attachment.html>


More information about the asterisk-code-review mailing list