[asterisk-commits] branch 1.2 r29764 - /branches/1.2/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue May 23 11:16:41 MST 2006


Author: kpfleming
Date: Tue May 23 13:16:40 2006
New Revision: 29764

URL: http://svn.digium.com/view/asterisk?rev=29764&view=rev
Log:
simplify/fix lock retry, and fix comment

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=29764&r1=29763&r2=29764&view=diff
==============================================================================
--- branches/1.2/channels/chan_sip.c (original)
+++ branches/1.2/channels/chan_sip.c Tue May 23 13:16:40 2006
@@ -11199,7 +11199,7 @@
 	int nounlock;
 	int recount = 0;
 	char iabuf[INET_ADDRSTRLEN];
-	int lockretrycount = 0;
+	unsigned int lockretry = 100;
 
 	len = sizeof(sin);
 	memset(&req, 0, sizeof(req));
@@ -11252,13 +11252,12 @@
 			ast_log(LOG_DEBUG, "Failed to grab lock, trying again...\n");
 			ast_mutex_unlock(&p->lock);
 			ast_mutex_unlock(&netlock);
-			/* Sleep infintismly short amount of time */
+			/* Sleep for a very short amount of time */
 			usleep(1);
-			lockretrycount++;
-			if (lockretrycount < 100)
+			if (--lockretry)
 				goto retrylock;
 		}
-		if (lockretrycount > 100) {
+		if (!lockretry) {
 			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");



More information about the asterisk-commits mailing list