[asterisk-commits] irroot: branch irroot/distrotech-customers-1.8 r334445 - /team/irroot/distrot...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Sep 5 05:47:35 CDT 2011


Author: irroot
Date: Mon Sep  5 05:47:24 2011
New Revision: 334445

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=334445
Log:
Remove need for queues lock in try_calling it should be in compare_weight

Modified:
    team/irroot/distrotech-customers-1.8/apps/app_queue.c

Modified: team/irroot/distrotech-customers-1.8/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/irroot/distrotech-customers-1.8/apps/app_queue.c?view=diff&rev=334445&r1=334444&r2=334445
==============================================================================
--- team/irroot/distrotech-customers-1.8/apps/app_queue.c (original)
+++ team/irroot/distrotech-customers-1.8/apps/app_queue.c Mon Sep  5 05:47:24 2011
@@ -2982,9 +2982,8 @@
 	struct member *mem;
 	int found = 0;
 	struct ao2_iterator queue_iter;
-	
-	/* q's lock and rq's lock already set by try_calling()
-	 * to solve deadlock */
+
+	ao2_lock(queues);
 	queue_iter = ao2_iterator_init(queues, 0);
 	while ((q = ao2_t_iterator_next(&queue_iter, "Iterate through queues"))) {
 		if (q == rq) { /* don't check myself, could deadlock */
@@ -3009,6 +3008,7 @@
 		}
 	}
 	ao2_iterator_destroy(&queue_iter);
+	ao2_unlock(queues);
 	return found;
 }
 
@@ -4106,8 +4106,8 @@
 
 	struct member *mem;
 	struct call_queue *qtmp;
-	struct ao2_iterator queue_iter;	
-	
+	struct ao2_iterator queue_iter;
+
 	if (shared_lastcall) {
 		ao2_lock(queues);
 		queue_iter = ao2_iterator_init(queues, 0);
@@ -4450,7 +4450,6 @@
 	struct ao2_iterator memi;
 	struct ast_datastore *datastore, *transfer_ds;
 	struct queue_end_bridge *queue_end_bridge = NULL;
-	const int need_weight = use_weight;
 
 	ast_channel_lock(qe->chan);
 	datastore = ast_channel_datastore_find(qe->chan, &dialed_interface_info, NULL);
@@ -4534,8 +4533,6 @@
 	}
 
 	/* Hold the lock while we setup the outgoing calls */
-	if (need_weight)
-		ao2_lock(queues);
 	ao2_lock(qe->parent);
 	ast_debug(1, "%s is trying to call a queue member.\n",
 							qe->chan->name);
@@ -4554,8 +4551,6 @@
 			ao2_ref(cur, -1);
 			ao2_unlock(qe->parent);
 			ao2_iterator_destroy(&memi);
-			if (need_weight)
-				ao2_unlock(queues);
 			goto out;
 		}
 		if (!datastore) {
@@ -4563,8 +4558,6 @@
 				ao2_ref(cur, -1);
 				ao2_unlock(qe->parent);
 				ao2_iterator_destroy(&memi);
-				if (need_weight)
-					ao2_unlock(queues);
 				callattempt_free(tmp);
 				goto out;
 			}
@@ -4573,8 +4566,6 @@
 				ao2_ref(cur, -1);
 				ao2_unlock(&qe->parent);
 				ao2_iterator_destroy(&memi);
-				if (need_weight)
-					ao2_unlock(queues);
 				callattempt_free(tmp);
 				goto out;
 			}
@@ -4611,8 +4602,6 @@
 				ao2_ref(cur, -1);
 				ao2_unlock(qe->parent);
 				ao2_iterator_destroy(&memi);
-				if (need_weight)
-					ao2_unlock(queues);
 				callattempt_free(tmp);
 				goto out;
 			}
@@ -4674,9 +4663,6 @@
 	orig = to;
 	++qe->pending;
 	ao2_unlock(qe->parent);
-	if (need_weight) {
-		ao2_unlock(queues);
-	}
 	ring_one(qe, outgoing, &numbusies);
 	lpeer = wait_for_answer(qe, outgoing, &to, &digit, numbusies, ast_test_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT), forwardsallowed, update_connectedline);
 	/* The ast_channel_datastore_remove() function could fail here if the




More information about the asterisk-commits mailing list