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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 23 15:14:48 CDT 2013


Author: mjordan
Date: Fri Aug 23 15:14:46 2013
New Revision: 397585

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=397585
Log:
Fix error in using ast_channel_snapshot_type before initialization

Starting Asterisk would kick back an ERROR message stating that the Stasis
message type ast_channel_snapshot_type was used prior to initialization.
This occurred due to the caching topic being created prior to the message
type that it depended on.

This patch re-orders the start up such that the message type is initialized
prior to the caching topic. It also checks the return value of the
initialization of the agent login/logoff types.

Modified:
    trunk/main/stasis_channels.c

Modified: trunk/main/stasis_channels.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/stasis_channels.c?view=diff&rev=397585&r1=397584&r2=397585
==============================================================================
--- trunk/main/stasis_channels.c (original)
+++ trunk/main/stasis_channels.c Fri Aug 23 15:14:46 2013
@@ -969,13 +969,16 @@
 	if (!channel_cache_all) {
 		return -1;
 	}
-	STASIS_MESSAGE_TYPE_INIT(ast_channel_agent_login_type);
-	STASIS_MESSAGE_TYPE_INIT(ast_channel_agent_logoff_type);
+	res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_agent_login_type);
+	res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_agent_logoff_type);
 
 	channel_cache_by_name = stasis_cache_create(channel_snapshot_get_name);
 	if (!channel_cache_by_name) {
 		return -1;
 	}
+
+	/* This should be initialized before the caching topic */
+	res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_snapshot_type);
 
 	channel_by_name_topic = stasis_caching_topic_create(
 		stasis_cp_all_topic(channel_cache_all),
@@ -984,7 +987,6 @@
 		return -1;
 	}
 
-	res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_snapshot_type);
 	res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_dial_type);
 	res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_varset_type);
 	res |= STASIS_MESSAGE_TYPE_INIT(ast_channel_user_event_type);




More information about the asterisk-commits mailing list