diff options
author | David M. Lee <dlee@digium.com> | 2013-07-23 13:42:46 +0000 |
---|---|---|
committer | David M. Lee <dlee@digium.com> | 2013-07-23 13:42:46 +0000 |
commit | f6a227a45111d5d0e021de64799f62da6d8ae7ac (patch) | |
tree | f27976b9d96cdee85907fbb9c44f6a25661eeafd /res/stasis/app.h | |
parent | fec667646fb63fb0d55d26cf76ade739dc62bcfe (diff) |
Continue events when ARI WebSocket reconnects
This patch addresses a bug in the /ari/events WebSocket in handling
reconnects.
When a Stasis application's associated WebSocket was disconnected and
reconnected, it would not receive events for any channels or bridges
it was subscribed to.
The fix was to lazily clean up Stasis application registrations,
instead of removing them as soon as the WebSocket goes away.
When an application is unregistered at the WebSocket level, the
underlying application is simply deactivated. If the application
WebSocket is reconnected, the application is reactivated for the new
connection.
To avoid memory leaks from lingering, unused application, the
application list is cleaned up whenever new applications are
registered/unregistered.
(closes issue ASTERISK-21970)
Review: https://reviewboard.asterisk.org/r/2678/
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@395120 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/stasis/app.h')
-rw-r--r-- | res/stasis/app.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/res/stasis/app.h b/res/stasis/app.h index 7a5405a89..0cf92217f 100644 --- a/res/stasis/app.h +++ b/res/stasis/app.h @@ -48,8 +48,38 @@ struct app; struct app *app_create(const char *name, stasis_app_cb handler, void *data); /*! + * \brief Deactivates an application. + * + * Any channels currently in the application remain active (since the app might + * come back), but new channels are rejected. + * + * \param app Application to deactivate. + */ +void app_deactivate(struct app *app); + +/*! + * \brief Checks whether an app is active. + * + * \param app Application to check. + * \return True (non-zero) if app is active. + * \return False (zero) if app has been deactivated. + */ +int app_is_active(struct app *app); + +/*! + * \brief Checks whether a deactivated app has no channels. + * + * \param app Application to check. + * \param True (non-zero) if app is deactivated, and has no associated channels. + * \param False (zero) otherwise. + */ +int app_is_finished(struct app *app); + +/*! * \brief Update the handler and data for a \c res_stasis application. * + * If app has been deactivated, this will reactivate it. + * * \param app Application to update. * \param handler New application callback. * \param data New data pointer for the callback. |