[asterisk-commits] kmoore: branch kmoore/stasis-device_state r383376 - /team/kmoore/stasis-devic...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 19 13:51:48 CDT 2013


Author: kmoore
Date: Tue Mar 19 13:51:46 2013
New Revision: 383376

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383376
Log:
Ensure the device state aggregator is only called after the cache is updated

Modified:
    team/kmoore/stasis-device_state/main/devicestate.c

Modified: team/kmoore/stasis-device_state/main/devicestate.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-device_state/main/devicestate.c?view=diff&rev=383376&r1=383375&r2=383376
==============================================================================
--- team/kmoore/stasis-device_state/main/devicestate.c (original)
+++ team/kmoore/stasis-device_state/main/devicestate.c Tue Mar 19 13:51:46 2013
@@ -617,6 +617,14 @@
 	RAII_VAR(struct stasis_message *, new_aggregate_msg, NULL, ao2_cleanup);
 	RAII_VAR(struct stasis_device_state *, new_aggregate_state, NULL, ao2_cleanup);
 
+	if (stasis_cache_update() == stasis_message_type(msg)) {
+		struct stasis_cache_update *update = stasis_message_data(msg);
+		if (!update->new_snapshot) {
+			return;
+		}
+		msg = update->new_snapshot;
+	}
+
 	if (stasis_device_state_message() != stasis_message_type(msg)) {
 		return;
 	}
@@ -798,7 +806,7 @@
 		return -1;
 	}
 
-	devstate_message_sub = stasis_subscribe(stasis_device_state_topic_all(), devstate_change_collector_cb, NULL);
+	devstate_message_sub = stasis_subscribe(stasis_caching_get_topic(stasis_device_state_topic_cached()), devstate_change_collector_cb, NULL);
 
 	if (!devstate_message_sub) {
 		ast_log(LOG_ERROR, "Failed to create subscription for the device state change collector\n");




More information about the asterisk-commits mailing list