From: David M. Lee Date: Wed, 22 May 2013 19:15:16 +0000 (+0000) Subject: Fixed startup race condition which caused occasional stasis_mwi_state_type assertions. X-Git-Tag: 13.0.0-beta1~1778 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a5a09e62cd772202178a52383630291cb7ae145;p=thirdparty%2Fasterisk.git Fixed startup race condition which caused occasional stasis_mwi_state_type assertions. The caching topic (which refers to the message type) was created before the message type. If the initial subscription message gets processed before the type can be initialized, the assertion about using an uninitialized type fires. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@389519 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/app.c b/main/app.c index 0e8a68f7ba..1473c06cbe 100644 --- a/main/app.c +++ b/main/app.c @@ -2735,6 +2735,9 @@ static void app_exit(void) int app_init(void) { + if (STASIS_MESSAGE_TYPE_INIT(stasis_mwi_state_type) != 0) { + return -1; + } mwi_topic_all = stasis_topic_create("stasis_mwi_topic"); if (!mwi_topic_all) { return -1; @@ -2743,9 +2746,6 @@ int app_init(void) if (!mwi_topic_cached) { return -1; } - if (STASIS_MESSAGE_TYPE_INIT(stasis_mwi_state_type) != 0) { - return -1; - } mwi_topic_pool = stasis_topic_pool_create(mwi_topic_all); if (!mwi_topic_pool) { return -1;