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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 4 14:07:10 CST 2008


Author: mmichelson
Date: Fri Jan  4 14:07:09 2008
New Revision: 96548

URL: http://svn.digium.com/view/asterisk?view=rev&rev=96548
Log:
I have tested reloads to death now. They should be logically correct now.

Next step: Realtime!


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=96548&r1=96547&r2=96548
==============================================================================
--- team/mmichelson/queue-state/apps/app_queue.c (original)
+++ team/mmichelson/queue-state/apps/app_queue.c Fri Jan  4 14:07:09 2008
@@ -974,8 +974,6 @@
 		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;
 			}
@@ -998,7 +996,7 @@
 				ast_debug(1, "Removing %s from the list of interfaces that make up all of our queue members.\n", interface);
 				AST_LIST_REMOVE_CURRENT(list);
 				ast_free(curint);
-			}
+			} 
 			break;
 		}
 	}
@@ -1452,9 +1450,7 @@
 	while ((m = ao2_iterator_next(&mem_iter))) {
 		if (m->dead) {
 			ao2_unlink(q->members, m);
-			ao2_unlock(q);
 			remove_from_interfaces(m->state_interface);
-			ao2_lock(q);
 			q->membercount--;
 		}
 		ao2_ref(m, -1);
@@ -1566,9 +1562,7 @@
 	while ((m = ao2_iterator_next(&mem_iter))) {
 		if (m->dead) {
 			ao2_unlink(q->members, m);
-			ao2_unlock(q);
 			remove_from_interfaces(m->state_interface);
-			ao2_lock(q);
 			q->membercount--;
 		}
 		ao2_ref(m, -1);
@@ -4879,8 +4873,10 @@
 				/* Check if a queue with this name already exists */
 				if (q->found) {
 					ast_log(LOG_WARNING, "Queue '%s' already defined! Skipping!\n", cat);
-					if (!new)
+					if (!new) {
 						ao2_unlock(q);
+						queue_unref(q);
+					}
 					continue;
 				}
 				/* Due to the fact that the "linear" strategy will have a different allocation
@@ -4941,8 +4937,13 @@
 						/* Find the old position in the list */
 						ast_copy_string(tmpmem.interface, interface, sizeof(tmpmem.interface));
 						cur = ao2_find(q->members, &tmpmem, OBJ_POINTER | OBJ_UNLINK);
-
+						/* Only attempt removing from interfaces list if the new state_interface is different than the old one */
+						if (cur && strcasecmp(cur->state_interface, state_interface)) {
+							remove_from_interfaces(cur->state_interface);
+						}
 						newm = create_queue_member(interface, membername, penalty, cur ? cur->paused : 0, state_interface);
+						if (!cur || (cur && strcasecmp(cur->state_interface, state_interface)))
+							add_to_interfaces(state_interface);
 						ao2_link(q->members, newm);
 						ao2_ref(newm, -1);
 						newm = NULL;
@@ -4950,8 +4951,6 @@
 						if (cur)
 							ao2_ref(cur, -1);
 						else {
-							/* Add them to the master int list if necessary */
-							add_to_interfaces(state_interface);
 							q->membercount++;
 						}
 					} else {
@@ -4966,6 +4965,7 @@
 						ao2_ref(cur, -1);
 						continue;
 					}
+					ast_log(LOG_DEBUG, "%s in queue marked as delme, we should be deleting...\n", cur->interface);
 					q->membercount--;
 					ao2_unlink(q->members, cur);
 					remove_from_interfaces(cur->interface);
@@ -4974,7 +4974,7 @@
 
 				if (new) {
 					ao2_link(queues, q);
-				} else
+				} else 
 					ao2_unlock(q);
 				queue_unref(q);
 			}




More information about the asterisk-commits mailing list