[asterisk-commits] mmichelson: branch group/CCSS r242421 - /team/group/CCSS/main/ccss.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jan 22 15:32:41 CST 2010


Author: mmichelson
Date: Fri Jan 22 15:32:38 2010
New Revision: 242421

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=242421
Log:
Don't use the recall_data after unlocking the channel.


Modified:
    team/group/CCSS/main/ccss.c

Modified: team/group/CCSS/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=242421&r1=242420&r2=242421
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Fri Jan 22 15:32:38 2010
@@ -2869,6 +2869,7 @@
 	struct ast_cc_interface_tree *interface_tree;
 	char device_name[AST_CHANNEL_NAME];
 	struct cc_tree_item *device_tree_item;
+	int core_id_candidate;
 
 	ast_assert(core_id != NULL);
 
@@ -2916,6 +2917,12 @@
 
 	interface_tree = cc_ref(recall_data->interface_tree, "Bump refcount for tree while we search for specific channel");
 	ast_channel_get_device_name(chan, device_name, sizeof(device_name));
+	/* We grab the value of the recall_data->core_id so that we
+	 * can unlock the channel before we start looking through the
+	 * interface list. That way we don't have to worry about a possible
+	 * clash between the channel lock and the interface tree lock.
+	 */
+	core_id_candidate = recall_data->core_id;
 	ast_channel_unlock(chan);
 
 	/*
@@ -2927,7 +2934,7 @@
 		if (!strcmp(device_tree_item->interface->name, device_name) &&
 				!strcmp(device_tree_item->interface->monitor_type, monitor_type)) {
 			/* BOOM! Device is in the tree! We have a winner! */
-			*core_id = recall_data->core_id;
+			*core_id = core_id_candidate;
 			AST_LIST_UNLOCK(interface_tree);
 			cc_unref(interface_tree, "Found a match in recall tree.");
 			return 1;




More information about the asterisk-commits mailing list