[asterisk-commits] russell: branch russell/events r103669 - /team/russell/events/main/devicestate.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Feb 14 08:01:43 CST 2008


Author: russell
Date: Thu Feb 14 08:01:43 2008
New Revision: 103669

URL: http://svn.digium.com/view/asterisk?view=rev&rev=103669
Log:
Add some debug output to help trace the calculation of the aggregate device state

Modified:
    team/russell/events/main/devicestate.c

Modified: team/russell/events/main/devicestate.c
URL: http://svn.digium.com/view/asterisk/team/russell/events/main/devicestate.c?view=diff&rev=103669&r1=103668&r2=103669
==============================================================================
--- team/russell/events/main/devicestate.c (original)
+++ team/russell/events/main/devicestate.c Thu Feb 14 08:01:43 2008
@@ -686,8 +686,11 @@
 
 	ast_devstate_aggregate_init(&agg);
 
-	for (i = 0; i < collection->num_states; i++)
+	for (i = 0; i < collection->num_states; i++) {
+		ast_debug(1, "Adding per-server state of '%s' for '%s'\n", 
+			devstate2str(collection->states[i].state), device);
 		ast_devstate_aggregate_add(&agg, collection->states[i].state);
+	}
 
 	state = ast_devstate_aggregate_result(&agg);
 
@@ -704,9 +707,14 @@
 
 		if (state == old_state) {
 			/* No change since last reported device state */
+			ast_debug(1, "Aggregate state for device '%s' has not changed from '%s'\n",
+				device, devstate2str(state));
 			return;
 		}
 	}
+
+	ast_debug(1, "Aggregate state for device '%s' has changed to '%s'\n",
+		device, devstate2str(state));
 
 	event = ast_event_new(AST_EVENT_DEVICE_STATE,
 		AST_EVENT_IE_DEVICE, AST_EVENT_IE_PLTYPE_STR, device,
@@ -728,6 +736,8 @@
 		.num_states = 0,
 	};
 
+	ast_debug(1, "Processing device state change for '%s'\n", sc->device);
+
 	if (!(tmp_sub = ast_event_subscribe_new(AST_EVENT_DEVICE_STATE_CHANGE, devstate_cache_cb, &collection))) {
 		ast_log(LOG_ERROR, "Failed to create subscription\n");
 		return;




More information about the asterisk-commits mailing list