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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 3 07:13:50 CDT 2009


Author: mmichelson
Date: Thu Sep  3 07:13:47 2009
New Revision: 215885

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=215885
Log:
Remove more comments, fix refcount bugs.

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

Modified: team/group/CCSS/main/ccss.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=215885&r1=215884&r2=215885
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Thu Sep  3 07:13:47 2009
@@ -834,9 +834,6 @@
 
 static struct ast_cc_monitor *find_or_create_monitor(struct ast_cc_monitor *parent, struct ast_cc_interface *interface, const int core_id)
 {
-	/* I'll leave the finding part for later. For now, I'll place the
-	 * creation code here
-	 */
 	struct ast_cc_monitor *new_monitor;
 	struct ast_cc_monitor_link *new_link;
 	struct ast_cc_monitor *finder = alloca(sizeof(finder) + strlen(interface->name));
@@ -853,9 +850,8 @@
 	}
 
 	if (!(new_link = ast_calloc(1, sizeof(*new_link)))) {
-		if (monitor_created) {
-			ao2_ref(new_monitor, -1);
-		}
+		ao2_ref(new_monitor, -1);
+		ao2_unlink(cc_monitors, new_monitor);
 		return NULL;
 	}
 
@@ -867,33 +863,12 @@
 	ao2_ref(new_link->parent, +1);
 	AST_LIST_INSERT_TAIL(&parent->child_links, new_link, next);
 	AST_LIST_INSERT_TAIL(&new_monitor->parent_links, new_link, next);
+	ao2_ref(new_monitor, -1);
 	return new_monitor;
 }
 
 static void interface_tree_to_monitor(struct core_pending_cc_offer *pending_offer, struct cc_core_instance *core_instance)
 {
-	/* Oh boy
-	 *
-	 * Steps
-	 *
-	 * 1. Give the core_instance a reference to the root monitor.
-	 *
-	 * 2. Loop through the pending_offer's interface tree.
-	 * 
-	 * 3. For each interface encountered, see if there is
-	 * already a monitor for that interface set up.
-	 *
-	 * 		3a. If there is, create a new link from whatever
-	 * 		the appropriate parent is to the pre-existing monitor
-	 *
-	 * 		3b. If not, then create the new monitor, create a
-	 * 		link from the appropriate parent to a newly created
-	 * 		monitor.
-	 *
-	 * 4. unref the pending_offer's ref to the interface tree. This
-	 * SHOULD cause the interface_tree's destructor to be called.
-	 */
-
 	struct ast_cc_interface *parent_interface_iterator;
 
 	/* The way that the interface tree is set up, and the way this loop works, the
@@ -1241,6 +1216,7 @@
 	if (!(cc_sched_thread = ast_sched_thread_create())) {
 		return -1;
 	}
+	ast_log(LOG_NOTICE, "Successfully created CC sched_thread context\n");
 	/* Root monitor doesn't care about the core id. The root monitor uses
 	 * extension monitor callbacks since the gist of those will be to traverse
 	 * their child links and call each of their children's callbacks
@@ -1248,7 +1224,8 @@
 	if (!(root_monitor = cc_monitor_instance_init(AST_CC_ROOT_MONITOR, "extension", "root", -1))) {
 		return -1;
 	}
-	ast_log(LOG_NOTICE, "Successfully created CC sched_thread context\n");
+	ao2_ref(root_monitor, -1);
+	ast_log(LOG_NOTICE, "Successfully created root monitor\n");
 	res = ast_register_application2(ccreq_app, ccreq_exec, NULL, NULL, NULL);
 	res |= ast_register_application2(cccancel_app, cccancel_exec, NULL, NULL, NULL);
 	res |= ast_cc_monitor_register(&extension_monitor_cbs);




More information about the asterisk-commits mailing list