[asterisk-commits] mmichelson: branch group/CCSS_Monitor_Restructure r243063 - /team/group/CCSS_...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jan 25 17:45:19 CST 2010
Author: mmichelson
Date: Mon Jan 25 17:45:15 2010
New Revision: 243063
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=243063
Log:
Fix up conflicts in ccss.c.
No thanks to automerge-email for not telling me about it!
Modified:
team/group/CCSS_Monitor_Restructure/main/ccss.c
Modified: team/group/CCSS_Monitor_Restructure/main/ccss.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS_Monitor_Restructure/main/ccss.c?view=diff&rev=243063&r1=243062&r2=243063
==============================================================================
--- team/group/CCSS_Monitor_Restructure/main/ccss.c (original)
+++ team/group/CCSS_Monitor_Restructure/main/ccss.c Mon Jan 25 17:45:15 2010
@@ -1303,7 +1303,7 @@
static void dialed_cc_interfaces_destroy(void *data)
{
struct dialed_cc_interfaces *cc_interfaces = data;
- ao2_t_ref(cc_interfaces->interface_tree, -1, "Unref dial's ref to interface tree");
+ cc_unref(cc_interfaces->interface_tree, "Unref dial's ref to interface tree");
ast_free(cc_interfaces->current_extension_dialable_name);
ast_free(cc_interfaces);
}
@@ -1331,7 +1331,7 @@
new_cc_interfaces->ignore = old_cc_interfaces->ignore;
new_cc_interfaces->dial_parent_id = old_cc_interfaces->dial_parent_id;
new_cc_interfaces->is_original_caller = 0;
- ao2_t_ref(old_cc_interfaces->interface_tree, +1, "New ref due to duplication of interface tree");
+ cc_ref(old_cc_interfaces->interface_tree, "New ref due to duplication of interface tree");
new_cc_interfaces->core_id = old_cc_interfaces->core_id;
new_cc_interfaces->interface_tree = old_cc_interfaces->interface_tree;
return new_cc_interfaces;
@@ -1396,7 +1396,7 @@
}
if (!(monitor = ao2_alloc(sizeof(*monitor), cc_monitor_destroy))) {
- ao2_t_ref(cc_interface, -1, "failed to allocate the tree item, so unref the interface");
+ cc_unref(cc_interface, "failed to allocate the tree item, so unref the interface");
return NULL;
}
@@ -1553,19 +1553,19 @@
}
if (!(cc_interface->config_params = ast_cc_config_params_init())) {
- ao2_t_ref(cc_interface, -1, "Failed to allocate config params, unref interface");
+ cc_unref(cc_interface, "Failed to allocate config params, unref interface");
call_destructor_with_no_monitor(cc_data->monitor_type, cc_data->private_data);
return NULL;
}
if (!(monitor = ao2_alloc(sizeof(*monitor), cc_monitor_destroy))) {
- ao2_t_ref(cc_interface, -1, "Failed to allocate tree item, unref interface");
+ cc_unref(cc_interface, "Failed to allocate tree item, unref interface");
call_destructor_with_no_monitor(cc_data->monitor_type, cc_data->private_data);
return NULL;
}
if (!(monitor->dialable_name = ast_strdup(dialable_name))) {
- ao2_t_ref(cc_interface, -1, "Failed to copy dialable name");
+ cc_unref(cc_interface, "Failed to copy dialable name");
cc_unref(monitor, "Failed to copy dialable name. Unref monitor");
call_destructor_with_no_monitor(cc_data->monitor_type, cc_data->private_data);
return NULL;
@@ -2659,6 +2659,7 @@
struct ast_cc_interface_tree *interface_tree;
char device_name[AST_CHANNEL_NAME];
struct ast_cc_monitor *device_monitor;
+ int core_id_candidate;
ast_assert(core_id != NULL);
@@ -2706,6 +2707,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);
/*
@@ -2717,7 +2724,7 @@
if (!strcmp(device_monitor->interface->name, device_name) &&
!strcmp(device_monitor->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_DLLIST_UNLOCK(interface_tree);
cc_unref(interface_tree, "Found a match in recall tree.");
return 1;
More information about the asterisk-commits
mailing list