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
This commit is contained in:
Corey Farrell
2015-05-22 22:50:43 -04:00
parent f66c41e668
commit 50044fdc15
13 changed files with 38 additions and 35 deletions

View File

@@ -510,6 +510,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.
*