[asterisk-commits] kmoore: branch kmoore/stasis-mwi r382510 - in /team/kmoore/stasis-mwi: ./ mai...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Mar 6 11:39:47 CST 2013
Author: kmoore
Date: Wed Mar 6 11:39:44 2013
New Revision: 382510
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382510
Log:
Multiple revisions 382508-382509
........
r382508 | dlee | 2013-03-06 11:17:59 -0600 (Wed, 06 Mar 2013) | 1 line
Fixed race condition when destroying caching topics
........
r382509 | kmoore | 2013-03-06 11:37:19 -0600 (Wed, 06 Mar 2013) | 2 lines
Various cleanup, lifetime management fixups, and a memory leak fix
........
Merged revisions 382508-382509 from http://svn.asterisk.org/svn/asterisk/team/dlee/stasis-core
Modified:
team/kmoore/stasis-mwi/ (props changed)
team/kmoore/stasis-mwi/main/stasis_cache.c
team/kmoore/stasis-mwi/tests/test_stasis.c
Propchange: team/kmoore/stasis-mwi/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Mar 6 11:39:44 2013
@@ -1,1 +1,1 @@
-/team/dlee/stasis-core:1-382504
+/team/dlee/stasis-core:1-382509
Modified: team/kmoore/stasis-mwi/main/stasis_cache.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-mwi/main/stasis_cache.c?view=diff&rev=382510&r1=382509&r2=382510
==============================================================================
--- team/kmoore/stasis-mwi/main/stasis_cache.c (original)
+++ team/kmoore/stasis-mwi/main/stasis_cache.c Wed Mar 6 11:39:44 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");
}
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=382510&r1=382509&r2=382510
==============================================================================
--- team/kmoore/stasis-mwi/tests/test_stasis.c (original)
+++ team/kmoore/stasis-mwi/tests/test_stasis.c Wed Mar 6 11:39:44 2013
@@ -119,15 +119,6 @@
int complete;
};
-static struct stasis_subscription * local_stasis_subscribe(struct stasis_topic *topic, stasis_subscription_cb callback, struct consumer *consumer)
-{
- struct stasis_subscription *sub;
- /* Bump the ref count of the consumer since it's being held by the subscription */
- ao2_ref(consumer, +1);
- sub = stasis_subscribe(topic, callback, consumer);
- return sub;
-}
-
static void consumer_dtor(void *obj) {
struct consumer *consumer = obj;
@@ -335,7 +326,7 @@
consumer = consumer_create(1);
ast_test_validate(test, NULL != consumer);
- uut = local_stasis_subscribe(topic, consumer_exec, consumer);
+ uut = stasis_subscribe(topic, consumer_exec, consumer);
ast_test_validate(test, NULL != uut);
ao2_ref(consumer, +1);
@@ -381,7 +372,7 @@
consumer = consumer_create(1);
ast_test_validate(test, NULL != consumer);
- uut = local_stasis_subscribe(topic, consumer_exec, consumer);
+ uut = stasis_subscribe(topic, consumer_exec, consumer);
ast_test_validate(test, NULL != uut);
ao2_ref(consumer, +1);
@@ -446,7 +437,7 @@
consumer = consumer_create(1);
ast_test_validate(test, NULL != consumer);
- parent_sub = local_stasis_subscribe(parent_topic, consumer_exec, parent_consumer);
+ parent_sub = stasis_subscribe(parent_topic, consumer_exec, parent_consumer);
ast_test_validate(test, NULL != parent_sub);
ao2_ref(parent_consumer, +1);
sub = stasis_subscribe(topic, consumer_exec, consumer);
@@ -540,7 +531,7 @@
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);
+ sub = stasis_subscribe(stasis_caching_get_topic(caching_topic), consumer_exec, consumer);
ast_test_validate(test, NULL != sub);
ao2_ref(consumer, +1);
@@ -595,7 +586,7 @@
consumer = consumer_create(1);
ast_test_validate(test, NULL != consumer);
- sub = local_stasis_subscribe(stasis_caching_get_topic(caching_topic), consumer_exec, consumer);
+ sub = stasis_subscribe(stasis_caching_get_topic(caching_topic), consumer_exec, consumer);
ast_test_validate(test, NULL != sub);
ao2_ref(consumer, +1);
More information about the asterisk-commits
mailing list