diff options
author | Terry Wilson <twilson@digium.com> | 2012-05-22 17:29:12 +0000 |
---|---|---|
committer | Terry Wilson <twilson@digium.com> | 2012-05-22 17:29:12 +0000 |
commit | c7f2d02ef1d4e5c10987c807ecec377453bb425c (patch) | |
tree | da503e5fa4934f3ac37b243571c4cc6ca2641e0c /include | |
parent | 1ffb200c0e8642b7fb5c4f174e0064877f0c3d85 (diff) |
Fix race condition for CEL LINKEDID_END event
This patch fixes to situations that could cause the CEL LINKEDID_END event to
be missed.
1) During a core stop gracefully, modules are unloaded when ast_active_channels
== 0. The LINKDEDID_END event fires during the channel destructor. This means
that occasionally, the cel_* module will be unloaded before the channel is
destroyed. It seemed generally useful to wait until the refcount of all
channels == 0 before unloading, so I added a channel counter and used it in the
shutdown code.
2) During a masquerade, ast_channel_change_linkedid is called. It calls
ast_cel_check_retire_linkedid which unrefs the linkedid in the linkedids
container in cel.c. It didn't ref the new linkedid. Now it does.
Review: https://reviewboard.asterisk.org/r/1900/
........
Merged revisions 367292 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 367299 from http://svn.asterisk.org/svn/asterisk/branches/10
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@367309 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/cel.h | 9 | ||||
-rw-r--r-- | include/asterisk/channel.h | 5 |
2 files changed, 13 insertions, 1 deletions
diff --git a/include/asterisk/cel.h b/include/asterisk/cel.h index b388ffd9b..25a3a4af1 100644 --- a/include/asterisk/cel.h +++ b/include/asterisk/cel.h @@ -188,6 +188,15 @@ const char *ast_cel_get_ama_flag_name(enum ast_cel_ama_flag flag); void ast_cel_check_retire_linkedid(struct ast_channel *chan); /*! + * \brief Inform CEL that a new linkedid is being used + * \since 11 + * + * \retval -1 error + * \retval 0 success + */ +int ast_cel_linkedid_ref(const char *linkedid); + +/*! * \brief Create a fake channel from data in a CEL event * * \note diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index 1a1c99885..59008a6fe 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -2104,9 +2104,12 @@ void ast_begin_shutdown(int hangup); /*! Cancels an existing shutdown and returns to normal operation */ void ast_cancel_shutdown(void); -/*! \return number of active/allocated channels */ +/*! \return number of channels available for lookup */ int ast_active_channels(void); +/*! \return the number of channels not yet destroyed */ +int ast_undestroyed_channels(void); + /*! \return non-zero if Asterisk is being shut down */ int ast_shutting_down(void); |