[asterisk-commits] dvossel: branch 1.4 r246115 - /branches/1.4/apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 10 11:44:25 CST 2010


Author: dvossel
Date: Wed Feb 10 11:44:20 2010
New Revision: 246115

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=246115
Log:
fixes random deadlock in app_queue with use_weight during reload

(closes issue #16677)
Reported by: tim_ringenbach
Patches:
      app_queue_use_weight_deadlock.diff uploaded by tim ringenbach (license 540)


Modified:
    branches/1.4/apps/app_queue.c

Modified: branches/1.4/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/apps/app_queue.c?view=diff&rev=246115&r1=246114&r2=246115
==============================================================================
--- branches/1.4/apps/app_queue.c (original)
+++ branches/1.4/apps/app_queue.c Wed Feb 10 11:44:20 2010
@@ -2822,6 +2822,7 @@
 	int callcompletedinsl;
 	struct ao2_iterator memi;
 	struct ast_datastore *datastore, *transfer_ds;
+	const int need_weight = use_weight;
 
 	ast_channel_lock(qe->chan);
 	datastore = ast_channel_datastore_find(qe->chan, &dialed_interface_info, NULL);
@@ -2875,7 +2876,8 @@
 		}
 
 	/* Hold the lock while we setup the outgoing calls */
-	if (use_weight)
+
+	if (need_weight)
 		AST_LIST_LOCK(&queues);
 	ao2_lock(qe->parent);
 	if (option_debug)
@@ -2896,7 +2898,7 @@
 			ao2_iterator_destroy(&memi);
 			ao2_ref(cur, -1);
 			ao2_unlock(qe->parent);
-			if (use_weight)
+			if (need_weight)
 				AST_LIST_UNLOCK(&queues);
 			goto out;
 		}
@@ -2905,7 +2907,7 @@
 				ao2_iterator_destroy(&memi);
 				ao2_ref(cur, -1);
 				ao2_unlock(qe->parent);
-				if (use_weight)
+				if (need_weight)
 					AST_LIST_UNLOCK(&queues);
 				free(tmp);
 				goto out;
@@ -2915,7 +2917,7 @@
 				ao2_iterator_destroy(&memi);
 				ao2_ref(cur, -1);
 				ao2_unlock(qe->parent);
-				if (use_weight)
+				if (need_weight)
 					AST_LIST_UNLOCK(&queues);
 				free(tmp);
 				goto out;
@@ -2953,7 +2955,7 @@
 				ao2_iterator_destroy(&memi);
 				ao2_ref(cur, -1);
 				ao2_unlock(qe->parent);
-				if (use_weight)
+				if (need_weight)
 					AST_LIST_UNLOCK(&queues);
 				free(tmp);
 				goto out;
@@ -2994,7 +2996,7 @@
 	++qe->pending;
 	ao2_unlock(qe->parent);
 	ring_one(qe, outgoing, &numbusies);
-	if (use_weight)
+	if (need_weight)
 		AST_LIST_UNLOCK(&queues);
 	lpeer = wait_for_answer(qe, outgoing, &to, &digit, numbusies, ast_test_flag(&(bridge_config.features_caller), AST_FEATURE_DISCONNECT), forwardsallowed);
 	/* The ast_channel_datastore_remove() function could fail here if the




More information about the asterisk-commits mailing list