diff options
author | Matthew Jordan <mjordan@digium.com> | 2013-08-23 20:14:46 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2013-08-23 20:14:46 +0000 |
commit | 3d9c5e61af502ae166b2ed4333af9c263b98ef42 (patch) | |
tree | 1dfc9a16bbadcced86629418f84e38a900461b59 | |
parent | c13d0b7bdc390d39e411cecb517957d975fb1cc2 (diff) |
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.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397585 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | main/stasis_channels.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/main/stasis_channels.c b/main/stasis_channels.c index 1efc51dbb..0fbbf5d96 100644 --- a/main/stasis_channels.c +++ b/main/stasis_channels.c @@ -969,14 +969,17 @@ int ast_stasis_channels_init(void) 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), channel_cache_by_name); @@ -984,7 +987,6 @@ int ast_stasis_channels_init(void) 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); |