[Asterisk-code-review] app queue: Only remove queue member from pending when state ... (asterisk[certified/13.8])

Anonymous Coward asteriskteam at digium.com
Sun Jan 29 14:06:01 CST 2017


Anonymous Coward #1000019 has submitted this change and it was merged. ( https://gerrit.asterisk.org/4814 )

Change subject: app_queue: Only remove queue member from pending when state changes.
......................................................................


app_queue: Only remove queue member from pending when state changes.

It is possible for a not in use state change to occur multiple
times causing a queue member to be removed from the pending call
container prematurely.

The first not in use state change will remove the queue member
from the container. At this moment the member may be called and
placed in the pending container. After this another not in use
state change can be received which will remove it from the
container. Despite being called at this point the code will
incorrectly see that there are no pending calls to it.

This change only removes it from the pending container if the
state has actually changed.

ASTERISK-26133 #close
patches:
  app_queue.diff submitted by Richard Miller (license 5685)

Change-Id: Ie5a7f17a44f98e9159e9b85009ce3f8393aa78c0
(cherry picked from commit 8a4546146542e867e085d201e5cf164e9d6532a4)
---
M apps/app_queue.c
1 file changed, 10 insertions(+), 3 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved; Verified



diff --git a/apps/app_queue.c b/apps/app_queue.c
index ef8b3bd..0e968d9 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2338,10 +2338,17 @@
 */
 static void update_status(struct call_queue *q, struct member *m, const int status)
 {
-	m->status = status;
+	if (m->status != status) {
+		m->status = status;
 
-	/* Whatever the status is clear the member from the pending members pool */
-	pending_members_remove(m);
+		/* Remove the member from the pending members pool only when the status changes.
+		 * This is not done unconditionally because we can occasionally see multiple
+		 * device state notifications of not in use after a previous call has ended,
+		 * including after we have initiated a new call. This is more likely to
+		 * happen when there is latency in the connection to the member.
+		 */
+		pending_members_remove(m);
+	}
 
 	queue_publish_member_blob(queue_member_status_type(), queue_member_blob_create(q, m));
 }

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie5a7f17a44f98e9159e9b85009ce3f8393aa78c0
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: certified/13.8
Gerrit-Owner: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list