[asterisk-commits] branch 1.2 r29733 -
/branches/1.2/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue May 23 10:17:02 MST 2006
Author: bweschke
Date: Tue May 23 12:17:02 2006
New Revision: 29733
URL: http://svn.digium.com/view/asterisk?rev=29733&view=rev
Log:
Sanity check code for an extended failure in trying to obtain a channel lock that may have been obtained elsewhere. Prevents the monitor thread of the SIP module from going into an infinite loop, effectively, breaking SIP until you restart Asterisk or the mutex is unlocked, whichever comes first.
Modified:
branches/1.2/channels/chan_sip.c
Modified: branches/1.2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_sip.c?rev=29733&r1=29732&r2=29733&view=diff
==============================================================================
--- branches/1.2/channels/chan_sip.c (original)
+++ branches/1.2/channels/chan_sip.c Tue May 23 12:17:02 2006
@@ -11199,6 +11199,7 @@
int nounlock;
int recount = 0;
char iabuf[INET_ADDRSTRLEN];
+ int lockretrycount = 0;
len = sizeof(sin);
memset(&req, 0, sizeof(req));
@@ -11253,7 +11254,15 @@
ast_mutex_unlock(&netlock);
/* Sleep infintismly short amount of time */
usleep(1);
- goto retrylock;
+ lockretrycount++;
+ if (lockretrycount < 100)
+ goto retrylock;
+ }
+ if (lockretrycount > 100) {
+ ast_log(LOG_ERROR, "We could NOT get the channel lock for %s! \n", p->owner->name);
+ ast_log(LOG_ERROR, "SIP MESSAGE JUST IGNORED: %s \n", req.data);
+ ast_log(LOG_ERROR, "BAD! BAD! BAD!\n");
+ return 1;
}
memcpy(&p->recv, &sin, sizeof(p->recv));
if (recordhistory) {
More information about the asterisk-commits
mailing list