[svn-commits] dlee: branch dlee/stasis-core r382508 - /team/dlee/stasis-core/main/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Wed Mar 6 11:18:02 CST 2013


Author: dlee
Date: Wed Mar  6 11:17:59 2013
New Revision: 382508

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382508
Log:
Fixed race condition when destroying caching topics

Modified:
    team/dlee/stasis-core/main/stasis_cache.c

Modified: team/dlee/stasis-core/main/stasis_cache.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-core/main/stasis_cache.c?view=diff&rev=382508&r1=382507&r2=382508
==============================================================================
--- team/dlee/stasis-core/main/stasis_cache.c (original)
+++ team/dlee/stasis-core/main/stasis_cache.c Wed Mar  6 11:17:59 2013
@@ -51,7 +51,8 @@
 
 static void stasis_caching_topic_dtor(void *obj) {
 	struct stasis_caching_topic *caching_topic = obj;
-	ast_assert(caching_topic->sub == NULL);
+	ast_assert(!stasis_subscription_is_subscribed(caching_topic->sub));
+	caching_topic->sub = NULL;
 	ao2_cleanup(caching_topic->cache);
 	caching_topic->cache = NULL;
 	ao2_cleanup(caching_topic->topic);
@@ -66,9 +67,8 @@
 void stasis_caching_unsubscribe(struct stasis_caching_topic *caching_topic)
 {
 	if (caching_topic) {
-		if (caching_topic->sub) {
+		if (stasis_subscription_is_subscribed(caching_topic->sub)) {
 			stasis_unsubscribe(caching_topic->sub);
-			caching_topic->sub = NULL;
 		} else {
 			ast_log(LOG_ERROR, "stasis_caching_topic unsubscribed multiple times\n");
 		}




More information about the svn-commits mailing list