From: Russell Bryant Date: Fri, 3 Dec 2004 23:35:36 +0000 (+0000) Subject: Release call lock while we look for the peer to avoid a deadlock X-Git-Tag: 1.0.11.1~354 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0b74a19625e4ccf719c25f9b75d81be2e03d3500;p=thirdparty%2Fasterisk.git Release call lock while we look for the peer to avoid a deadlock git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/v1-0@4384 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/CHANGES b/CHANGES index 5ead87309e..1c9bfdf389 100755 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,8 @@ -- fix bug with supervised transfers -- chan_h323 -- fix compilation problem + -- chan_iax2 + -- avoid a deadlock related to a static config of a BUNCH of peers -- cdr_pgsql -- fix memory leak when reading config -- Numerous other minor bug fixes diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index b49afdbfa6..510995b7e0 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -3852,12 +3852,15 @@ static int register_verify(int callno, struct sockaddr_in *sin, struct iax_ies * ast_log(LOG_NOTICE, "Empty registration from %s\n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr)); return -1; } - + /* We release the lock for the call to prevent a deadlock, but it's okay because + only the current thread could possibly make it go away or make changes */ + ast_mutex_unlock(&iaxsl[callno]); ast_mutex_lock(&peerl.lock); for (p = peerl.peers; p ; p = p->next) if (!strcasecmp(p->name, peer)) break; ast_mutex_unlock(&peerl.lock); + ast_mutex_lock(&iaxsl[callno]); #ifdef MYSQL_FRIENDS if (!p) p = mysql_peer(peer);