[asterisk-commits] kmoore: branch kmoore/stasis-mwi r382371 - /team/kmoore/stasis-mwi/main/app.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 4 09:34:50 CST 2013


Author: kmoore
Date: Mon Mar  4 09:34:47 2013
New Revision: 382371

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382371
Log:
Fix refcount bug and let MWI cache handle subscription changes

Modified:
    team/kmoore/stasis-mwi/main/app.c

Modified: team/kmoore/stasis-mwi/main/app.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/main/app.c?view=diff&rev=382371&r1=382370&r2=382371
==============================================================================
--- team/kmoore/stasis-mwi/main/app.c (original)
+++ team/kmoore/stasis-mwi/main/app.c Mon Mar  4 09:34:47 2013
@@ -2745,19 +2745,20 @@
 	ast_assert(stasis_mwi_topic(uniqueid) != NULL);
 	stasis_publish(stasis_mwi_topic(uniqueid), message);
 
-	ao2_ref(mwi_state, +1);
 	return 0;
 }
 
 static const char *mwi_state_get_id(struct stasis_message *message)
 {
-	struct stasis_mwi_state *mwi_state;
-	if (stasis_mwi_state() != stasis_message_type(message)) {
-		return NULL;
-	}
-
-	mwi_state = stasis_message_data(message);
-	return mwi_state->uniqueid;
+	if (stasis_mwi_state() == stasis_message_type(message)) {
+		struct stasis_mwi_state *mwi_state = stasis_message_data(message);
+		return mwi_state->uniqueid;
+	} else if (stasis_subscription_change() == stasis_message_type(message)) {
+		struct stasis_subscription_change *change = stasis_message_data(message);
+		return change->uniqueid;
+	}
+
+	return NULL;
 }
 
 static int mwi_topic_hash(const void *obj, const int flags)




More information about the asterisk-commits mailing list