[asterisk-commits] mmichelson: branch mmichelson/queue-state r96268 - /team/mmichelson/queue-sta...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 3 13:03:14 CST 2008


Author: mmichelson
Date: Thu Jan  3 13:03:13 2008
New Revision: 96268

URL: http://svn.digium.com/view/asterisk?view=rev&rev=96268
Log:
Fixed the logic involving the removal of state interfaces from the list of interfaces.

At this point, I consider the coding complete for this branch. I will do some extensive testing
next. Any further commits to this branch will be in response to problems encountered during testing


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

Modified: team/mmichelson/queue-state/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue-state/apps/app_queue.c?view=diff&rev=96268&r1=96267&r2=96268
==============================================================================
--- team/mmichelson/queue-state/apps/app_queue.c (original)
+++ team/mmichelson/queue-state/apps/app_queue.c Thu Jan  3 13:03:13 2008
@@ -963,20 +963,22 @@
 {
 	struct call_queue *q;
 	struct member *mem, tmpmem;
-	struct ao2_iterator queue_iter;
+	struct ao2_iterator queue_iter, mem_iter;
 	int ret = 0;
 
 	ast_copy_string(tmpmem.interface, interface, sizeof(tmpmem.interface));
 	queue_iter = ao2_iterator_init(queues, 0);
 	while ((q = ao2_iterator_next(&queue_iter))) {
-
 		ao2_lock(q);
-		if ((mem = ao2_find(q->members, &tmpmem, OBJ_POINTER))) {
-			ao2_ref(mem, -1);
-			ao2_unlock(q);
-			queue_unref(q);
-			ret = 1;
-			break;
+		mem_iter = ao2_iterator_init(q->members, 0);
+		while ((mem = ao2_iterator_next(&mem_iter))) { 
+			if (!strcasecmp(mem->state_interface, interface)) {
+				ao2_ref(mem, -1);
+				ao2_unlock(q);
+				queue_unref(q);
+				ret = 1;
+				break;
+			}
 		}
 		ao2_unlock(q);
 		queue_unref(q);
@@ -1312,7 +1314,7 @@
 	while ((cur = ao2_iterator_next(&mem_iter))) {
 		if (all || !cur->dynamic) {
 			ao2_unlink(q->members, cur);
-			remove_from_interfaces(cur->interface);
+			remove_from_interfaces(cur->state_interface);
 			q->membercount--;
 		}
 		ao2_ref(cur, -1);
@@ -1451,7 +1453,7 @@
 		if (m->dead) {
 			ao2_unlink(q->members, m);
 			ao2_unlock(q);
-			remove_from_interfaces(m->interface);
+			remove_from_interfaces(m->state_interface);
 			ao2_lock(q);
 			q->membercount--;
 		}
@@ -1565,7 +1567,7 @@
 		if (m->dead) {
 			ao2_unlink(q->members, m);
 			ao2_unlock(q);
-			remove_from_interfaces(m->interface);
+			remove_from_interfaces(m->state_interface);
 			ao2_lock(q);
 			q->membercount--;
 		}
@@ -3575,6 +3577,7 @@
 				"MemberName: %s\r\n",
 				q->name, mem->interface, mem->membername);
 			ao2_unlink(q->members, mem);
+			remove_from_interfaces(mem->state_interface);
 			ao2_ref(mem, -1);
 
 			if (queue_persistent_members)
@@ -3587,9 +3590,6 @@
 		ao2_unlock(q);
 		queue_unref(q);
 	}
-
-	if (res == RES_OKAY)
-		remove_from_interfaces(interface);
 
 	return res;
 }
@@ -4966,10 +4966,9 @@
 						ao2_ref(cur, -1);
 						continue;
 					}
-
-					remove_from_interfaces(cur->interface);
 					q->membercount--;
 					ao2_unlink(q->members, cur);
+					remove_from_interfaces(cur->interface);
 					ao2_ref(cur, -1);
 				}
 




More information about the asterisk-commits mailing list