[asterisk-commits] mmichelson: branch group/rls r417917 - /team/group/rls/res/res_pjsip_pubsub.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jul 3 13:00:17 CDT 2014


Author: mmichelson
Date: Thu Jul  3 13:00:15 2014
New Revision: 417917

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=417917
Log:
Add requested debug messages from /r/3699.

This adds debug messages when building a resource tree so that
it can be seen how it is being built and where problems may
lie.

This also adds a debug message to an existing function that
indicates when a real subscription is being removed from the
master list of subscriptions.


Modified:
    team/group/rls/res/res_pjsip_pubsub.c

Modified: team/group/rls/res/res_pjsip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/team/group/rls/res/res_pjsip_pubsub.c?view=diff&rev=417917&r1=417916&r2=417917
==============================================================================
--- team/group/rls/res/res_pjsip_pubsub.c (original)
+++ team/group/rls/res/res_pjsip_pubsub.c Thu Jul  3 13:00:15 2014
@@ -779,6 +779,7 @@
 		const char *resource = AST_VECTOR_GET(&list->items, i);
 
 		if (have_visited(resource, visited)) {
+			ast_debug(1, "Already visited resource %s. Avoiding duplicate resource or potential loop.\n", resource);
 			continue;
 		}
 
@@ -786,15 +787,24 @@
 		if (!child_list) {
 			int resp = handler->notifier->new_subscribe(endpoint, resource);
 			if (PJSIP_IS_STATUS_IN_CLASS(resp, 200)) {
+				ast_debug(1, "Subscription to leaf resource %s resulted in success. Adding to parent %s\n",
+						resource, parent->resource);
 				current = tree_node_alloc(resource, visited);
 				AST_VECTOR_APPEND(&parent->children, current);
+			} else {
+				ast_debug(1, "Subscription to leaf resource %s resulted in error response %d\n",
+						resource, resp);
 			}
 		} else {
+			ast_debug(1, "Resource %s is a list\n", resource);
 			current = tree_node_alloc(resource, visited);
 			build_node_children(endpoint, handler, child_list, current, visited);
 			if (AST_VECTOR_SIZE(&current->children) > 0) {
+				ast_debug(1, "List %s had no successful children.\n", resource);
 				AST_VECTOR_APPEND(&parent->children, current);
 			} else {
+				ast_debug(1, "List %s had successful children. Adding to parent %s\n",
+						resource, parent->resource);
 				tree_node_destroy(current);
 			}
 			ao2_cleanup(child_list);
@@ -864,10 +874,12 @@
 
 	list = retrieve_resource_list(resource, handler->event_name);
 	if (!list) {
+		ast_debug(1, "Subscription to resource %s is not to a list\n", resource);
 		tree->root = tree_node_alloc(resource, NULL);
 		return handler->notifier->new_subscribe(endpoint, resource);
 	}
 
+	ast_debug(1, "Subscription to resource %s is a list\n", resource);
 	AST_VECTOR_INIT(&visited, AST_VECTOR_SIZE(&list->items));
 	tree->root = tree_node_alloc(resource, &visited);
 	build_node_children(endpoint, handler, list, tree->root, &visited);
@@ -929,6 +941,8 @@
 	AST_RWLIST_TRAVERSE_SAFE_BEGIN(&subscriptions, i, next) {
 		if (i == obj) {
 			AST_RWLIST_REMOVE_CURRENT(next);
+			ast_debug(1, "Removing subscription to resource %s from list of subscriptions\n",
+					ast_sip_subscription_get_resource_name(i));
 			ast_module_unref(ast_module_info->self);
 			break;
 		}




More information about the asterisk-commits mailing list