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 /include | |
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 'include')
-rw-r--r-- | include/asterisk/stasis.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/asterisk/stasis.h b/include/asterisk/stasis.h index aa681e13e..69b2d0f22 100644 --- a/include/asterisk/stasis.h +++ b/include/asterisk/stasis.h @@ -511,6 +511,17 @@ void stasis_publish_sync(struct stasis_subscription *sub, struct stasis_message typedef void (*stasis_subscription_cb)(void *data, struct stasis_subscription *sub, struct stasis_message *message); /*! + * \brief Stasis subscription callback function that does nothing. + * + * \note This callback should be used for events are not directly processed, but need + * to be generated so data can be retrieved from cache later. Subscriptions with this + * callback can be released with \ref stasis_unsubscribe, even during module unload. + * + * \since 13.5 + */ +void stasis_subscription_cb_noop(void *data, struct stasis_subscription *sub, struct stasis_message *message); + +/*! * \brief Create a subscription. * * In addition to being AO2 managed memory (requiring an ao2_cleanup() to free |