[asterisk-commits] branch bweschke/polycom_acd_functions r29693 - /team/bweschke/polycom_acd_fun...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue May 23 07:01:32 MST 2006


Author: bweschke
Date: Tue May 23 09:01:31 2006
New Revision: 29693

URL: http://svn.digium.com/view/asterisk?rev=29693&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.


Modified:
    team/bweschke/polycom_acd_functions/channels/chan_sip.c

Modified: team/bweschke/polycom_acd_functions/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/channels/chan_sip.c?rev=29693&r1=29692&r2=29693&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/channels/chan_sip.c (original)
+++ team/bweschke/polycom_acd_functions/channels/chan_sip.c Tue May 23 09:01:31 2006
@@ -12427,6 +12427,7 @@
 	int nounlock;
 	int recount = 0;
 	char iabuf[INET_ADDRSTRLEN];
+	int lockretrycount = 0;
 
 	len = sizeof(sin);
 	memset(&req, 0, sizeof(req));
@@ -12485,7 +12486,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;
 		}
 		p->recv = sin;
 		if (recordhistory) /* This is a request or response, note what it was for */



More information about the asterisk-commits mailing list