diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-24 16:17:01 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-24 16:17:01 +0000 |
commit | 6c055001f00785598971e5afa5f43bff68c1c77d (patch) | |
tree | f5cac429cfbf4566f4595a415f3b90237030400b /channels | |
parent | 5440bfb98ec91391e947be7a644c2cb3f56c767b (diff) |
More deadlock avoidance code (this time between sip_monitor and sip_hangup)
Reported by: apsaras
Patch by: tilghman
(Closes issue #11413)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@94765 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 4cdf35495..c33c747b4 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -15497,7 +15497,14 @@ restartsearch: get back to this point every millisecond or less) */ for (sip = iflist; !fastrestart && sip; sip = sip->next) { - ast_mutex_lock(&sip->lock); + /*! \note If we can't get a lock on an interface, skip it and come + * back later. Note that there is the possibility of a deadlock with + * sip_hangup otherwise, because sip_hangup is called with the channel + * locked first, and the iface lock is attempted second. + */ + if (ast_mutex_trylock(&sip->lock)) + continue; + /* Check RTP timeouts and kill calls if we have a timeout set and do not get RTP */ if (sip->rtp && sip->owner && (sip->owner->_state == AST_STATE_UP) && |