diff options
author | Corey Farrell <git@cfware.com> | 2015-05-22 22:50:43 -0400 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2015-05-22 22:30:22 -0500 |
commit | 50044fdc15197b3a4a742827c97fc25daddc98aa (patch) | |
tree | 562e2b031fecf6cd7c5830410fd0eee0fed9a322 /channels/chan_iax2.c | |
parent | f66c41e668429b9a07dfdf30832c02ddc223f4a4 (diff) |
Stasis: Fix unsafe use of stasis_unsubscribe in modules.
Many uses of stasis_unsubscribe in modules can be reached through unload.
These have been switched to stasis_unsubscribe_and_join.
Some subscription callbacks do nothing, for these I've created a noop
callback function in stasis.c. This is used by some modules that monitor
MWI topics in order to enable cache, since the callback does not become
invalid after dlclose it is safe to use stasis_unsubscribe on these, even
during module unload.
ASTERISK-25121 #close
Change-Id: Ifc2549fbd8eef7d703c222978e8f452e2972189c
Diffstat (limited to 'channels/chan_iax2.c')
-rw-r--r-- | channels/chan_iax2.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 0c27d2d63..dbad79dcc 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -1430,13 +1430,6 @@ static int iax2_is_control_frame_allowed(int subtype) return is_allowed; } -static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg) -{ - /* The MWI subscriptions exist just so the core knows we care about those - * mailboxes. However, we just grab the events out of the cache when it - * is time to send MWI, since it is only sent with a REGACK. */ -} - static void network_change_stasis_subscribe(void) { if (!network_change_sub) { @@ -13010,7 +13003,10 @@ static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, st mailbox_specific_topic = ast_mwi_topic(peer->mailbox); if (mailbox_specific_topic) { - peer->mwi_event_sub = stasis_subscribe_pool(mailbox_specific_topic, mwi_event_cb, NULL); + /* The MWI subscriptions exist just so the core knows we care about those + * mailboxes. However, we just grab the events out of the cache when it + * is time to send MWI, since it is only sent with a REGACK. */ + peer->mwi_event_sub = stasis_subscribe_pool(mailbox_specific_topic, stasis_subscription_cb_noop, NULL); } } |