[asterisk-commits] mmichelson: branch 1.8 r371306 - /branches/1.8/apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 15 18:10:15 CDT 2012


Author: mmichelson
Date: Wed Aug 15 18:10:11 2012
New Revision: 371306

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=371306
Log:
Fix bug where final queue member would not be removed from memory.

If a static queue had realtime members, then there could be a potential
for those realtime members not to be properly deleted from memory.

If the queue's members were loaded from realtime and then all the
members were deleted from the backend, then the queue would still
think these members existed. The reason was that there was a short-
circuit in code such that if there were no members found in the
backend, then the queue would not be updated to reflect this.

Note that this only affected static queues with realtime members.
Realtime queues with realtime members were unaffected by this issue.

(closes issue ASTERISK-19793)
reported by Marcus Haas


Modified:
    branches/1.8/apps/app_queue.c

Modified: branches/1.8/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/apps/app_queue.c?view=diff&rev=371306&r1=371305&r2=371306
==============================================================================
--- branches/1.8/apps/app_queue.c (original)
+++ branches/1.8/apps/app_queue.c Wed Aug 15 18:10:11 2012
@@ -2408,8 +2408,19 @@
 	struct ao2_iterator mem_iter;
 
 	if (!(member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", q->name , SENTINEL))) {
-		/*This queue doesn't have realtime members*/
+		/* This queue doesn't have realtime members. If the queue still has any realtime
+		 * members in memory, they need to be removed.
+		 */
+		ao2_lock(q);
+		mem_iter = ao2_iterator_init(q->members, 0);
+		while ((m = ao2_iterator_next(&mem_iter))) {
+			if (m->realtime) {
+				ao2_unlink(q->members, m);
+			}
+			ao2_ref(m, -1);
+		}
 		ast_debug(3, "Queue %s has no realtime members defined. No need for update\n", q->name);
+		ao2_unlock(q);
 		return;
 	}
 




More information about the asterisk-commits mailing list