Take advantage of the fact that stasis_unsubscribe now returns NULL
authorKinsey Moore <kmoore@digium.com>
Fri, 15 Mar 2013 13:04:52 +0000 (13:04 +0000)
committerKinsey Moore <kmoore@digium.com>
Fri, 15 Mar 2013 13:04:52 +0000 (13:04 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383169 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/channel_internal_api.c
main/manager.c
tests/test_stasis.c

index d646d84..0867524 100644 (file)
@@ -1367,8 +1367,7 @@ void ast_channel_internal_cleanup(struct ast_channel *chan)
 
        ast_string_field_free_memory(chan);
 
-       stasis_unsubscribe(chan->forwarder);
-       chan->forwarder = NULL;
+       chan->forwarder = stasis_unsubscribe(chan->forwarder);
 
        ao2_cleanup(chan->topic);
        chan->topic = NULL;
index d5d5ccc..821fde8 100644 (file)
@@ -7590,8 +7590,7 @@ static void manager_shutdown(void)
 {
        struct ast_manager_user *user;
 
-       stasis_unsubscribe(channel_state_sub);
-       channel_state_sub = NULL;
+       channel_state_sub = stasis_unsubscribe(channel_state_sub);
 
        if (registered) {
                ast_manager_unregister("Ping");
index 3682294..fb81ecd 100644 (file)
@@ -276,8 +276,7 @@ AST_TEST_DEFINE(subscription_messages)
        ao2_ref(consumer, +1);
        expected_uniqueid = ast_strdup(stasis_subscription_uniqueid(uut));
 
-       stasis_unsubscribe(uut);
-       uut = NULL;
+       uut = stasis_unsubscribe(uut);
        complete = consumer_wait_for_completion(consumer);
        ast_test_validate(test, 1 == complete);
 
@@ -376,8 +375,7 @@ AST_TEST_DEFINE(unsubscribe_stops_messages)
        ast_test_validate(test, NULL != uut);
        ao2_ref(consumer, +1);
 
-       stasis_unsubscribe(uut);
-       uut = NULL;
+       uut = stasis_unsubscribe(uut);
 
        test_data = ao2_alloc(1, NULL);
        ast_test_validate(test, NULL != test_data);