[svn-commits] mmichelson: branch group/CCSS_Monitor_Restructure r244330 - /team/group/CCSS_...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Feb 2 12:53:05 CST 2010


Author: mmichelson
Date: Tue Feb  2 12:53:03 2010
New Revision: 244330

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=244330
Log:
Fix a bunch of refcount problems with generic monitors.


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=244330&r1=244329&r2=244330
==============================================================================
--- team/group/CCSS_Monitor_Restructure/main/ccss.c (original)
+++ team/group/CCSS_Monitor_Restructure/main/ccss.c Tue Feb  2 12:53:03 2010
@@ -25,6 +25,7 @@
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
+#define REF_DEBUG 1
 #include "asterisk/astobj2.h"
 #include "asterisk/strings.h"
 #include "asterisk/ccss.h"
@@ -989,12 +990,14 @@
 		 * time between subscribing to its device state and the time this executes.
 		 * Not really a big deal.
 		 */
+		cc_unref(gtcd->monitor, "Can't find generic list. Unref monitor in generic_monitor_devstate_tp_cb");
 		ast_free(gtcd);
 		return 0;
 	}
 
 	if (generic_list->current_state == new_state) {
 		/* The device state hasn't actually changed, so we don't really care */
+		cc_unref(gtcd->monitor, "State hasn't changed. Done with monitor in generic_monitor_devstate_tp_cb");
 		ast_free(gtcd);
 		cc_unref(generic_list, "Kill reference of generic list in devstate taskprocessor callback");
 		return 0;
@@ -1011,6 +1014,7 @@
 		}	
 	}
 	cc_unref(generic_list, "Kill reference of generic list in devstate taskprocessor callback");
+	cc_unref(gtcd->monitor, "Done with monitor ref in generic_monitor_devstate_tp_cb");
 	ast_free(gtcd);
 	return 0;
 }
@@ -1029,10 +1033,11 @@
 		return;
 	}
 
-	gtcd->monitor = monitor;
+	gtcd->monitor = cc_ref(monitor, "Getting monitor reference for taskprocessor callback");
 	gtcd->new_state = ast_event_get_ie_uint(event, AST_EVENT_IE_STATE);
 
 	if (ast_taskprocessor_push(cc_core_taskprocessor, generic_monitor_devstate_tp_cb, gtcd)) {
+		cc_unref(gtcd->monitor, "Couldn't push taskprocessor callback. unref monitor");
 		ast_free(gtcd);
 	}
 }
@@ -1118,6 +1123,7 @@
 	 * take any further actions
 	 */
 	if (state != AST_DEVICE_NOT_INUSE && state != AST_DEVICE_UNKNOWN) {
+		cc_unref(generic_list, "Device is in use. Nothing to do. Unref generic list.");
 		return 0;
 	}
 
@@ -1168,6 +1174,7 @@
 			break;
 		}
 	}
+	cc_unref(generic_list, "Done with generic list in cc_generic_monitor_unsuspend");
 	return 0;
 }
 
@@ -2097,7 +2104,7 @@
 
 	/* We can't unsubscribe from device state events here because it causes a deadlock */
 	if (ast_taskprocessor_push(cc_core_taskprocessor, generic_agent_devstate_unsubscribe,
-		cc_ref(agent, "ref agent for device state unsubscription"))) {
+			cc_ref(agent, "ref agent for device state unsubscription"))) {
 		cc_unref(agent, "Unref agent unsubscribing from devstate failed");
 	}
 	ast_str_set(&str, 0, "%s is no longer busy\n", agent->interface);
@@ -2642,7 +2649,7 @@
 	if (!new_data) {
 		return NULL;
 	}
-	new_data->interface_tree = cc_ref(old_data->interface_tree, "Bump refcount of interface tree for recall");
+	new_data->interface_tree = cc_ref(old_data->interface_tree, "Bump refcount of interface tree for recall datastore duplicate");
 	new_data->core_id = old_data->core_id;
 	new_data->nested = 1;
 	return new_data;
@@ -2683,7 +2690,7 @@
 	}
 
 	recall_data->interface_tree = cc_ref(core_instance->monitors,
-			"Bump refcount for interface tree for agent");
+			"Bump refcount for interface tree for recall datastore");
 	recall_data->core_id = core_id;
 	recall_datastore->data = recall_data;
 	recall_datastore->inheritance = DATASTORE_INHERIT_FOREVER;




More information about the svn-commits mailing list