[asterisk-commits] mmichelson: branch group/CCSS_Monitor_Restructure r244241 - /team/group/CCSS_...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 1 17:07:22 CST 2010


Author: mmichelson
Date: Mon Feb  1 17:07:20 2010
New Revision: 244241

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=244241
Log:
Change when we call cancel_available_timer.

The problem I had was when I tried to test canceling CC. The problem
was that the scheduler still held a reference to my monitor from when
the available timer was started. Due to when cancel_available_timer
was called, the result always a crash. Now we call cancel_available_timer
before unreffing the monitor either from the interface list destructor
or from cc_monitor_failed.


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=244241&r1=244240&r2=244241
==============================================================================
--- team/group/CCSS_Monitor_Restructure/main/ccss.c (original)
+++ team/group/CCSS_Monitor_Restructure/main/ccss.c Mon Feb  1 17:07:20 2010
@@ -1250,7 +1250,6 @@
 	 */
 	ast_log_dynamic_level(cc_logger_level, "Calling destructor for monitor %s, core ID %d\n", monitor->interface->name, monitor->core_id);
 	if (monitor->callbacks) {
-		monitor->callbacks->cancel_available_timer(monitor->private_data, &monitor->available_timer_id);
 		monitor->callbacks->destructor(monitor->private_data);
 	}
 	cc_unref(monitor->interface, "Unreffing tree's reference to interface");
@@ -1262,6 +1261,9 @@
 	struct ast_cc_interface_tree *cc_interface_tree = data;
 	struct ast_cc_monitor *monitor;
 	while ((monitor = AST_DLLIST_REMOVE_HEAD(cc_interface_tree, next))) {
+		if (monitor->callbacks) {
+			monitor->callbacks->cancel_available_timer(monitor, &monitor->available_timer_id);
+		}
 		cc_unref(monitor, "Destroying all monitors");
 	}
 	AST_DLLIST_HEAD_DESTROY(cc_interface_tree);
@@ -3024,6 +3026,7 @@
 		if (monitor_iter->interface->monitor_class == AST_CC_DEVICE_MONITOR) {
 			if (!strcmp(monitor_iter->interface->name, failure_data->device_name)) {
 				AST_DLLIST_REMOVE_CURRENT(next);
+				monitor_iter->callbacks->cancel_available_timer(monitor_iter, &monitor_iter->available_timer_id);
 				cc_unref(monitor_iter, "Monitor reported failure. Unref list's reference.");
 			}
 		} else if (!has_children(monitor_iter)) {




More information about the asterisk-commits mailing list