[svn-commits] mmichelson: branch mmichelson/queue-reset r166965 - /team/mmichelson/queue-re...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Dec 31 14:21:00 CST 2008


Author: mmichelson
Date: Wed Dec 31 14:21:00 2008
New Revision: 166965

URL: http://svn.digium.com/view/asterisk?view=rev&rev=166965
Log:
Add some comments to help clarify some code portions


Modified:
    team/mmichelson/queue-reset/apps/app_queue.c

Modified: team/mmichelson/queue-reset/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue-reset/apps/app_queue.c?view=diff&rev=166965&r1=166964&r2=166965
==============================================================================
--- team/mmichelson/queue-reset/apps/app_queue.c (original)
+++ team/mmichelson/queue-reset/apps/app_queue.c Wed Dec 31 14:21:00 2008
@@ -5557,8 +5557,7 @@
 
 	if (cur) {
 		ao2_ref(cur, -1);
-	}
-	else {
+	} else {
 		q->membercount++;
 	}
 }
@@ -5601,17 +5600,20 @@
 		ao2_lock(q);
 		prev_weight = q->weight ? 1 : 0;
 	}
-	/* Check if a queue with this name already exists */
+	/* Check if we already found a queue with this name in the config file */
 	if (q->found) {
 		ast_log(LOG_WARNING, "Queue '%s' already defined! Skipping!\n", queuename);
 		if (!new) {
+			/* It should be impossible to *not* hit this case*/
 			ao2_unlock(q);
-			queue_unref(q);
-		}
+		}
+		queue_unref(q);
 		return;
 	}
 	/* Due to the fact that the "linear" strategy will have a different allocation
-	 * scheme for queue members, we must devise the queue's strategy before other initializations
+	 * scheme for queue members, we must devise the queue's strategy before other initializations.
+	 * To be specific, the linear strategy needs to function like a linked list, meaning the ao2
+	 * container used will have only a single bucket instead of the typical number.
 	 */
 	if (queue_reload) {
 		if ((tmpvar = ast_variable_retrieve(cfg, queuename, "strategy"))) {
@@ -5624,7 +5626,6 @@
 		} else {
 			q->strategy = QUEUE_STRATEGY_RINGALL;
 		}
-		/* Re-initialize the queue */
 		init_queue(q);
 	}
 	if (member_reload) {
@@ -5632,6 +5633,10 @@
 		mem_iter = ao2_iterator_init(q->members, 0);
 		while ((cur = ao2_iterator_next(&mem_iter))) {
 			if (!cur->dynamic) {
+				/* Since dynamic members will not be found in the config file,
+				 * marking them as delme here is sure to end up dooming them, so
+				 * don't do it
+				 */
 				cur->delme = 1;
 			}
 			ao2_ref(cur, -1);




More information about the svn-commits mailing list