[asterisk-commits] dlee: branch dlee/stasis-cache-split r394036 - /team/dlee/stasis-cache-split/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jul 10 20:16:56 CDT 2013


Author: dlee
Date: Wed Jul 10 20:16:54 2013
New Revision: 394036

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=394036
Log:
Minor fixes

Modified:
    team/dlee/stasis-cache-split/main/bridging.c
    team/dlee/stasis-cache-split/main/channel_internal_api.c
    team/dlee/stasis-cache-split/main/endpoints.c
    team/dlee/stasis-cache-split/main/stasis_cache.c

Modified: team/dlee/stasis-cache-split/main/bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/main/bridging.c?view=diff&rev=394036&r1=394035&r2=394036
==============================================================================
--- team/dlee/stasis-cache-split/main/bridging.c (original)
+++ team/dlee/stasis-cache-split/main/bridging.c Wed Jul 10 20:16:54 2013
@@ -44,6 +44,7 @@
 #include "asterisk/bridging_technology.h"
 #include "asterisk/stasis_bridging.h"
 #include "asterisk/stasis_channels.h"
+#include "asterisk/stasis_cache_pattern.h"
 #include "asterisk/app.h"
 #include "asterisk/file.h"
 #include "asterisk/module.h"
@@ -1525,6 +1526,8 @@
 	}
 
 	cleanup_video_mode(bridge);
+
+	stasis_cache_one_unsubscribe(bridge->topics);
 }
 
 struct ast_bridge *ast_bridge_register(struct ast_bridge *bridge)

Modified: team/dlee/stasis-cache-split/main/channel_internal_api.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/main/channel_internal_api.c?view=diff&rev=394036&r1=394035&r2=394036
==============================================================================
--- team/dlee/stasis-cache-split/main/channel_internal_api.c (original)
+++ team/dlee/stasis-cache-split/main/channel_internal_api.c Wed Jul 10 20:16:54 2013
@@ -1426,7 +1426,7 @@
 	chan->forwarder = stasis_unsubscribe(chan->forwarder);
 	chan->endpoint_forward = stasis_unsubscribe(chan->endpoint_forward);
 
-	ao2_cleanup(chan->topics);
+	stasis_cache_one_unsubscribe(chan->topics);
 	chan->topics = NULL;
 }
 

Modified: team/dlee/stasis-cache-split/main/endpoints.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/main/endpoints.c?view=diff&rev=394036&r1=394035&r2=394036
==============================================================================
--- team/dlee/stasis-cache-split/main/endpoints.c (original)
+++ team/dlee/stasis-cache-split/main/endpoints.c Wed Jul 10 20:16:54 2013
@@ -122,7 +122,7 @@
 	ao2_cleanup(endpoint->router);
 	endpoint->router = NULL;
 
-	ao2_cleanup(endpoint->topics);
+	stasis_cache_one_unsubscribe(endpoint->topics);
 	endpoint->topics = NULL;
 
 	ao2_cleanup(endpoint->channel_ids);

Modified: team/dlee/stasis-cache-split/main/stasis_cache.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-cache-split/main/stasis_cache.c?view=diff&rev=394036&r1=394035&r2=394036
==============================================================================
--- team/dlee/stasis-cache-split/main/stasis_cache.c (original)
+++ team/dlee/stasis-cache-split/main/stasis_cache.c Wed Jul 10 20:16:54 2013
@@ -402,15 +402,10 @@
 	struct stasis_subscription *sub, struct stasis_topic *topic,
 	struct stasis_message *message)
 {
-	RAII_VAR(struct stasis_caching_topic *, caching_topic_needs_unref, NULL, ao2_cleanup);
 	const char *id = NULL;
 
 	ast_assert(caching_topic->topic != NULL);
 	ast_assert(cache->id_fn != NULL);
-
-	if (stasis_subscription_final_message(sub, message)) {
-		caching_topic_needs_unref = caching_topic;
-	}
 
 	/* Handle cache clear event */
 	if (stasis_cache_clear_type() == stasis_message_type(message)) {
@@ -435,10 +430,6 @@
 				stasis_topic_name(caching_topic->topic), stasis_message_type_name(clear_type), clear_id);
 			return NULL;
 		}
-	}
-
-	if (stasis_subscription_final_message(sub, message)) {
-		ao2_cleanup(caching_topic);
 	}
 
 	id = cache->id_fn(message);
@@ -463,6 +454,16 @@
 	}
 }
 
+static struct stasis_cache *cache_next(struct stasis_cache *cache)
+{
+	if (!cache) {
+		return NULL;
+	} else {
+		SCOPED_AO2LOCK(lock, cache);
+		return cache->secondary_cache;
+	}
+}
+
 static void caching_topic_exec(void *data, struct stasis_subscription *sub,
 	struct stasis_topic *topic, struct stasis_message *message)
 {
@@ -478,18 +479,17 @@
 	}
 
 	/* Now update the secondary caches */
-	{
-		SCOPED_AO2LOCK(lock, cache);
-		cache = cache->secondary_cache;
-	}
+	cache = cache_next(cache);
 
 	while (cache) {
 		struct stasis_message *ignored =
 			update_cache(cache, caching_topic, sub, topic, message);
 		ao2_cleanup(ignored);
-		ao2_lock(cache);
-		cache = cache->secondary_cache;
-		ao2_unlock(cache);
+		cache = cache_next(cache);
+	}
+
+	if (stasis_subscription_final_message(sub, message)) {
+		ao2_cleanup(caching_topic);
 	}
 }
 




More information about the asterisk-commits mailing list