[asterisk-commits] dlee: trunk r389519 - /trunk/main/app.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 22 14:15:19 CDT 2013


Author: dlee
Date: Wed May 22 14:15:16 2013
New Revision: 389519

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=389519
Log:
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.

Modified:
    trunk/main/app.c

Modified: trunk/main/app.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/app.c?view=diff&rev=389519&r1=389518&r2=389519
==============================================================================
--- trunk/main/app.c (original)
+++ trunk/main/app.c Wed May 22 14:15:16 2013
@@ -2735,6 +2735,9 @@
 
 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 @@
 	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;




More information about the asterisk-commits mailing list