[asterisk-commits] file: branch 1.2 r60213 - /branches/1.2/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Apr 5 05:52:51 MST 2007


Author: file
Date: Thu Apr  5 07:52:50 2007
New Revision: 60213

URL: http://svn.digium.com/view/asterisk?view=rev&rev=60213
Log:
Only unlock our pvt and net locks if we are actually going to try to lock the owner again. (issue #9472 reported by zoa)

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?view=diff&rev=60213&r1=60212&r2=60213
==============================================================================
--- branches/1.2/channels/chan_sip.c (original)
+++ branches/1.2/channels/chan_sip.c Thu Apr  5 07:52:50 2007
@@ -11496,17 +11496,20 @@
 		/* Go ahead and lock the owner if it has one -- we may need it */
 		if (p->owner && ast_mutex_trylock(&p->owner->lock)) {
 			ast_log(LOG_DEBUG, "Failed to grab lock, trying again...\n");
+			if (--lockretry) {
+				ast_mutex_unlock(&p->lock);
+				ast_mutex_unlock(&netlock);
+				usleep(1);
+				goto retrylock;
+			}
+		}
+		if (!lockretry) {
+			if (p->owner)
+				ast_log(LOG_ERROR, "We could NOT get the channel lock for %s - Call ID %s! \n", p->owner->name, p->callid);
+			ast_log(LOG_ERROR, "SIP MESSAGE JUST IGNORED: %s \n", req.data);
+			ast_log(LOG_ERROR, "BAD! BAD! BAD!\n");
 			ast_mutex_unlock(&p->lock);
 			ast_mutex_unlock(&netlock);
-			/* Sleep for a very short amount of time */
-			usleep(1);
-			if (--lockretry)
-				goto retrylock;
-		}
-		if (!lockretry) {
-			ast_log(LOG_ERROR, "We could NOT get the channel lock for %s - Call ID %s! \n", p->owner->name, p->callid);
-			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));



More information about the asterisk-commits mailing list