diff options
author | mnicholson <mnicholson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-08-11 17:29:16 +0000 |
---|---|---|
committer | mnicholson <mnicholson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2010-08-11 17:29:16 +0000 |
commit | 6f587e2068fdc9cc9d6d6cfa79ddd735f33a83b1 (patch) | |
tree | a12dd35616649fcf2ead971a4f3289d2f98489eb /channels/chan_sip.c | |
parent | 1143277d069c17302a3b7e517a6e93e44f5d2110 (diff) |
Merged revisions 281760 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
........
r281760 | mnicholson | 2010-08-11 12:27:59 -0500 (Wed, 11 Aug 2010) | 4 lines
Avoid a deadlock in add_header_max_forwards().
Related to r276951
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@281761 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r-- | channels/chan_sip.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index d4e9f0af8..2a656bad8 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -9038,8 +9038,16 @@ static int add_header_max_forwards(struct sip_pvt *dialog, struct sip_request *r char clen[10]; const char *max = NULL; + /* deadlock avoidance */ + while (dialog->owner && ast_channel_trylock(dialog->owner)) { + sip_pvt_unlock(dialog); + usleep(1); + sip_pvt_lock(dialog); + } + if (dialog->owner) { max = pbx_builtin_getvar_helper(dialog->owner, "SIP_MAX_FORWARDS"); + ast_channel_unlock(dialog->owner); } /* The channel variable overrides the peer/channel value */ |