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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 1 16:30:54 CST 2010


Author: mmichelson
Date: Mon Feb  1 16:30:52 2010
New Revision: 244240

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=244240
Log:
Fix a lot of reference issues.

Most of these are extra unrefs of monitors that should not be present.
Also fixed several memory leaks in 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=244240&r1=244239&r2=244240
==============================================================================
--- team/group/CCSS_Monitor_Restructure/main/ccss.c (original)
+++ team/group/CCSS_Monitor_Restructure/main/ccss.c Mon Feb  1 16:30:52 2010
@@ -1040,8 +1040,11 @@
 int ast_cc_available_timer_expire(const void *data)
 {
 	struct ast_cc_monitor *monitor = (struct ast_cc_monitor *) data;
+	int res;
 	monitor->available_timer_id = -1;
-	return ast_cc_monitor_failed(monitor->core_id, monitor->interface->name, "Available timer expired for monitor");
+	res = ast_cc_monitor_failed(monitor->core_id, monitor->interface->name, "Available timer expired for monitor");
+	cc_unref(monitor, "Unref reference from scheduler\n");
+	return res;
 }
 
 static int cc_generic_monitor_request_cc(struct ast_cc_monitor *monitor, int *available_timer_id)
@@ -2373,7 +2376,6 @@
 			if (monitor_iter->callbacks->request_cc(monitor_iter, &monitor_iter->available_timer_id)) {
 				AST_DLLIST_REMOVE_CURRENT(next);
 				cc_unref(monitor_iter, "request_cc failed. Unref list's reference to monitor");
-				cc_unref(monitor_iter, "request_cc failed. Unref local reference to monitor");
 			} else {
 				manager_event(EVENT_FLAG_CC, "CCRequestSent",
 					"CoreID: %d\r\n"
@@ -2384,7 +2386,6 @@
 		} else if (!has_children(monitor_iter)) {
 			AST_DLLIST_REMOVE_CURRENT(next);
 			cc_unref(monitor_iter, "request_cc failed on all children. Unref list's reference to monitor");
-			cc_unref(monitor_iter, "request_cc failed on all children. Unref local reference to monitor");
 		}
 	}
 	AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_END;
@@ -2421,12 +2422,10 @@
 			if (monitor_iter->callbacks->unsuspend(monitor_iter)) {
 				AST_DLLIST_REMOVE_CURRENT(next);
 				cc_unref(monitor_iter, "unsuspend failed. Unref list's reference to monitor");
-				cc_unref(monitor_iter, "unsuspend failed. Unref local reference to monitor");
 			}
 		} else if (!has_children(monitor_iter)) {
 			AST_DLLIST_REMOVE_CURRENT(next);
 			cc_unref(monitor_iter, "unsuspend failed on all children. Unref list's reference to monitor");
-			cc_unref(monitor_iter, "unsuspend failed on all children. Unref local reference to monitor");
 		}
 	}
 	AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_END;
@@ -2474,12 +2473,10 @@
 			if (monitor_iter->callbacks->suspend(monitor_iter)) {
 				AST_DLLIST_REMOVE_CURRENT(next);
 				cc_unref(monitor_iter, "suspend failed. Unref list's reference to monitor");
-				cc_unref(monitor_iter, "suspend failed. Unref local reference to monitor");
 			}
 		} else if (!has_children(monitor_iter)) {
 			AST_DLLIST_REMOVE_CURRENT(next);
 			cc_unref(monitor_iter, "suspend failed on all children. Unref list's reference to monitor");
-			cc_unref(monitor_iter, "suspend failed on all children. Unref local reference to monitor");
 		}
 	}
 	AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_END;
@@ -2513,12 +2510,10 @@
 			if (monitor_iter->callbacks->cancel_available_timer(monitor_iter, &monitor_iter->available_timer_id)) {
 				AST_DLLIST_REMOVE_CURRENT(next);
 				cc_unref(monitor_iter, "cancel_available_timer failed. Unref list's reference to monitor");
-				cc_unref(monitor_iter, "cancel_available_timer failed. Unref local reference to monitor");
 			}
 		} else if (!has_children(monitor_iter)) {
 			AST_DLLIST_REMOVE_CURRENT(next);
 			cc_unref(monitor_iter, "cancel_available_timer failed on all children. Unref list's reference to monitor");
-			cc_unref(monitor_iter, "cancel_available_timer failed on all children. Unref local reference to monitor");
 		}
 	}
 	AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_END;
@@ -3030,12 +3025,10 @@
 			if (!strcmp(monitor_iter->interface->name, failure_data->device_name)) {
 				AST_DLLIST_REMOVE_CURRENT(next);
 				cc_unref(monitor_iter, "Monitor reported failure. Unref list's reference.");
-				cc_unref(monitor_iter, "Monitor reported failure. Unref local reference.");
 			}
 		} else if (!has_children(monitor_iter)) {
 			AST_DLLIST_REMOVE_CURRENT(next);
 			cc_unref(monitor_iter, "All of monitor's children reported failure. Unref list's reference.");
-			cc_unref(monitor_iter, "All of monitor's children reported failure. Unref local reference.");
 		}
 	}
 	AST_DLLIST_TRAVERSE_BACKWARDS_SAFE_END;
@@ -3047,6 +3040,7 @@
 	ast_free((char *) failure_data->device_name);
 	ast_free((char *) failure_data->debug);
 	ast_free(failure_data);
+	cc_unref(core_instance, "Finished with core_instance in cc_monitor_failed\n");
 	return 0;
 }
 




More information about the asterisk-commits mailing list