[asterisk-commits] mjordan: trunk r416561 - in /trunk: ./ main/stasis_channels.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 17 23:22:08 CDT 2014


Author: mjordan
Date: Tue Jun 17 23:22:05 2014
New Revision: 416561

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=416561
Log:
stasis_channels: Update the stasis cache if manager variables are needed

In r416211, the publishing of variable changes was modified such that a
cached channel snapshot was used if manager variables were not requested
with each AMI event. This was done to reduce the amount of channel snapshots
created.

However, an assumption was made that generating a channel snapshot and
publishing the snapshot to the channel topic was sufficient to ensure that
the cache would be updated; this is not the case. The channel snapshot type
must be used to force a snapshot update.

This patch updates the publication of channel variables such that the cache
is updated prior to publication of the channel variable message if manager
variables are in use. This ensures that all AMI events receive the variable
update when they are supposed to.

Note that this issue was caught by the Asterisk Test Suite (go go testing)
........

Merged revisions 416557 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/main/stasis_channels.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/main/stasis_channels.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/stasis_channels.c?view=diff&rev=416561&r1=416560&r2=416561
==============================================================================
--- trunk/main/stasis_channels.c (original)
+++ trunk/main/stasis_channels.c Tue Jun 17 23:22:05 2014
@@ -707,14 +707,18 @@
 		return;
 	}
 
-	if (chan && !ast_channel_has_manager_vars()) {
+	/*! If there are manager variables, force a cache update */
+	if (chan && ast_channel_has_manager_vars()) {
+		ast_channel_publish_snapshot(chan);
+	}
+
+	if (chan) {
 		ast_channel_publish_cached_blob(chan, ast_channel_varset_type(), blob);
 	} else {
-		/* This function is NULL safe. If there are manager variables,
-		 * we have to produce the full snapshot.
-		 */
-		ast_channel_publish_blob(chan, ast_channel_varset_type(), blob);
-	}
+		/* This function is NULL safe for global variables */
+		ast_channel_publish_blob(NULL, ast_channel_varset_type(), blob);
+	}
+
 	ast_json_unref(blob);
 }
 




More information about the asterisk-commits mailing list