[asterisk-commits] mmichelson: branch group/CCSS r218105 - in /team/group/CCSS: apps/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 11 17:38:47 CDT 2009


Author: mmichelson
Date: Fri Sep 11 17:38:43 2009
New Revision: 218105

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=218105
Log:
A ton of debug messages, plus one bug fix.

Use ast_str_hash_add in the monitor hash function because
of some silly overflows that were happening. This totally
screwed me up for a while, and Russell and Vossel came
to the rescue.


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

Modified: team/group/CCSS/apps/app_dial.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/apps/app_dial.c?view=diff&rev=218105&r1=218104&r2=218105
==============================================================================
--- team/group/CCSS/apps/app_dial.c (original)
+++ team/group/CCSS/apps/app_dial.c Fri Sep 11 17:38:43 2009
@@ -39,6 +39,8 @@
 #include <sys/stat.h>
 #include <netinet/in.h>
 
+#define REF_DEBUG 1
+#include "asterisk/astobj2.h"
 #include "asterisk/paths.h" /* use ast_config_AST_DATA_DIR */
 #include "asterisk/lock.h"
 #include "asterisk/file.h"

Modified: team/group/CCSS/main/ccss.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/CCSS/main/ccss.c?view=diff&rev=218105&r1=218104&r2=218105
==============================================================================
--- team/group/CCSS/main/ccss.c (original)
+++ team/group/CCSS/main/ccss.c Fri Sep 11 17:38:43 2009
@@ -22,6 +22,8 @@
  */
 
 #include "asterisk.h"
+#define REF_DEBUG 1
+#include "asterisk/astobj2.h"
 #include "asterisk/strings.h"
 #include "asterisk/ccss.h"
 #include "asterisk/channel.h"
@@ -134,6 +136,13 @@
 	 */
 };
 
+static int print_debug(void *obj, void *args, int flags)
+{
+	struct ast_cc_monitor *monitor = obj;
+	ast_log(LOG_NOTICE, "%s is in the container\n", monitor->name);
+	return 0;
+}
+
 struct ast_taskprocessor *cc_core_taskprocessor;
 struct ast_sched_thread *cc_sched_thread;
 
@@ -469,11 +478,7 @@
 static int cc_monitor_hash_fn(const void *obj, int flags)
 {
 	const struct ast_cc_monitor *monitor = obj;
-	/* I have no idea if adding the two hashes together
-	 * like this increases the odds of hash collisions or
-	 * not.
-	 */
-	return ast_str_hash(monitor->monitor_type) + ast_str_hash(monitor->name);
+	return ast_str_hash_add(monitor->monitor_type, ast_str_hash(monitor->name));
 }
 
 struct cc_core_instance {
@@ -875,6 +880,7 @@
 	AST_LIST_HEAD_INIT(&monitor->parent_links);
 	ast_log(LOG_NOTICE, "Created new monitor named %s of type %s\n", monitor->name, monitor->monitor_type);
 	ao2_t_link(cc_monitors, monitor, "Link monitor into container");
+	ao2_callback(cc_monitors, OBJ_NODATA, print_debug, NULL);
 	return monitor;
 }
 
@@ -977,6 +983,8 @@
 static void prune_links(struct ast_cc_monitor *monitor, const int core_id, struct ast_cc_monitor_link *link_parent)
 {
 	struct ast_cc_monitor_link *link_iter;
+	ast_log(LOG_NOTICE, "Prune links called for monitor %s\n", monitor->name);
+	ao2_callback(cc_monitors, OBJ_NODATA, print_debug, NULL);
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&monitor->child_links, link_iter, next_child) {
 		if (link_iter->core_id == core_id) {
 			prune_links(link_iter->child, core_id, link_iter);
@@ -985,22 +993,33 @@
 		}
 	}
 	AST_LIST_TRAVERSE_SAFE_END;
+	ast_log(LOG_NOTICE, "Finished traversing children of monitor %s\n", monitor->name);
 
 	if (link_parent) {
+		ast_log(LOG_NOTICE, "Removing parent link from monitor %s\n", monitor->name);
 		AST_LIST_REMOVE(&monitor->parent_links, link_parent, next_parent);
 	}
 	if (monitor->monitor_class == AST_CC_ROOT_MONITOR) {
 		/* Never ever under any circumstances unlink
 		 * the root monitor
 		 */
+		ast_log(LOG_NOTICE, "Not unlinking monitor %s because it is the root\n", monitor->name);
 		return;
 	}
+	ast_log(LOG_NOTICE, "Just a checkpoint. In prune_links for monitor %s\n", monitor->name);
 	if (AST_LIST_EMPTY(&monitor->parent_links) &&
 			AST_LIST_EMPTY(&monitor->child_links)) {
 		/* This should cause the monitor's destructor
 		 * callback to be called
 		 */
+		ast_log(LOG_NOTICE, "Unlinking monitor %s\n", monitor->name);
 		ao2_t_unlink(cc_monitors, monitor, "Unlink monitor since nothing refers to it anymore");
+	} else {
+		if (!AST_LIST_EMPTY(&monitor->parent_links)) {
+			ast_log(LOG_NOTICE, "Not unlinking %s because it has parent links, still\n", monitor->name);
+		} else {
+			ast_log(LOG_NOTICE, "Not unlinking %s because it has child links, stil\n", monitor->name);
+		}
 	}
 }
 




More information about the asterisk-commits mailing list