[asterisk-commits] kmoore: branch kmoore/stasis-mwi r382504 - in /team/kmoore/stasis-mwi: main/ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Mar 6 10:36:55 CST 2013


Author: kmoore
Date: Wed Mar  6 10:36:52 2013
New Revision: 382504

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382504
Log:
Make sure to use stasis_unsubscribe for all subscriptions and bring test_stasis.c closer to what's in stasis-core

Modified:
    team/kmoore/stasis-mwi/main/app.c
    team/kmoore/stasis-mwi/tests/test_stasis.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=382504&r1=382503&r2=382504
==============================================================================
--- team/kmoore/stasis-mwi/main/app.c (original)
+++ team/kmoore/stasis-mwi/main/app.c Wed Mar  6 10:36:52 2013
@@ -95,8 +95,11 @@
 {
 	struct mwi_topic *topic = obj;
 	ast_free(topic->uniqueid);
-	ao2_cleanup(topic->forward);
+	topic->uniqueid = NULL;
+	stasis_unsubscribe(topic->forward);
+	topic->forward = NULL;
 	ao2_cleanup(topic->topic);
+	topic->topic = NULL;
 }
 
 static struct mwi_topic *mwi_topic_alloc(void)

Modified: team/kmoore/stasis-mwi/tests/test_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/tests/test_stasis.c?view=diff&rev=382504&r1=382503&r2=382504
==============================================================================
--- team/kmoore/stasis-mwi/tests/test_stasis.c (original)
+++ team/kmoore/stasis-mwi/tests/test_stasis.c Wed Mar  6 10:36:52 2013
@@ -166,7 +166,6 @@
 static void consumer_exec(void *data, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *message)
 {
 	struct consumer *consumer = data;
-	RAII_VAR(struct consumer *, consumer_needs_unref, NULL, ao2_cleanup);
 
 	if (!consumer->ignore_subscriptions || stasis_message_type(message) != stasis_subscription_change()) {
 		SCOPED_MUTEX(lock, &consumer->lock);
@@ -333,7 +332,7 @@
 		break;
 	}
 
-	topic = stasis_topic_create("SubscribeTopic");
+	topic = stasis_topic_create("TestTopic");
 	ast_test_validate(test, NULL != topic);
 
 	consumer = consumer_create(1);
@@ -362,10 +361,10 @@
 {
 	RAII_VAR(struct stasis_topic *, topic, NULL, ao2_cleanup);
 	RAII_VAR(struct consumer *, consumer, NULL, ao2_cleanup);
+	RAII_VAR(struct stasis_subscription *, uut, NULL, stasis_unsubscribe);
 	RAII_VAR(char *, test_data, NULL, ao2_cleanup);
 	RAII_VAR(struct stasis_message_type *, test_message_type, NULL, ao2_cleanup);
 	RAII_VAR(struct stasis_message *, test_message, NULL, ao2_cleanup);
-	struct stasis_subscription *uut = NULL;
 	int actual_len;
 
 	switch (cmd) {
@@ -379,7 +378,7 @@
 		break;
 	}
 
-	topic = stasis_topic_create("UnsubsribeTopic");
+	topic = stasis_topic_create("TestTopic");
 	ast_test_validate(test, NULL != topic);
 
 	consumer = consumer_create(1);
@@ -437,9 +436,9 @@
 		break;
 	}
 
-	parent_topic = stasis_topic_create("ParentForwardTopic");
+	parent_topic = stasis_topic_create("ParentTestTopic");
 	ast_test_validate(test, NULL != parent_topic);
-	topic = stasis_topic_create("ForwardTopic");
+	topic = stasis_topic_create("TestTopic");
 	ast_test_validate(test, NULL != topic);
 
 	forward_sub = stasis_forward_all(topic, parent_topic);
@@ -538,15 +537,12 @@
 
 	non_cache_type = stasis_message_type_create("NonCacheable");
 	ast_test_validate(test, NULL != non_cache_type);
-
-	topic = stasis_topic_create("CachePassthroughTopic");
+	topic = stasis_topic_create("SomeTopic");
 	ast_test_validate(test, NULL != topic);
-
 	caching_topic = stasis_caching_topic_create(topic, cache_test_data_id);
 	ast_test_validate(test, NULL != caching_topic);
 	consumer = consumer_create(1);
 	ast_test_validate(test, NULL != consumer);
-
 	sub = local_stasis_subscribe(stasis_caching_get_topic(caching_topic), consumer_exec, consumer);
 	ast_test_validate(test, NULL != sub);
 	ao2_ref(consumer, +1);
@@ -595,10 +591,8 @@
 
 	cache_type = stasis_message_type_create("Cacheable");
 	ast_test_validate(test, NULL != cache_type);
-
-	topic = stasis_topic_create("CacheTopic");
+	topic = stasis_topic_create("SomeTopic");
 	ast_test_validate(test, NULL != topic);
-
 	caching_topic = stasis_caching_topic_create(topic, cache_test_data_id);
 	ast_test_validate(test, NULL != caching_topic);
 	consumer = consumer_create(1);




More information about the asterisk-commits mailing list