[asterisk-commits] file: trunk r68684 - in /trunk: ./ main/channel.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Jun 11 07:35:03 MST 2007


Author: file
Date: Mon Jun 11 09:35:02 2007
New Revision: 68684

URL: http://svn.digium.com/view/asterisk?view=rev&rev=68684
Log:
Merged revisions 68683 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r68683 | file | 2007-06-11 10:33:12 -0400 (Mon, 11 Jun 2007) | 10 lines

Merged revisions 68682 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r68682 | file | 2007-06-11 10:29:58 -0400 (Mon, 11 Jun 2007) | 2 lines

Improve deadlock handling of the channel list. (issue #8376 reported by one47)

........

................

Modified:
    trunk/   (props changed)
    trunk/main/channel.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Modified: trunk/main/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/main/channel.c?view=diff&rev=68684&r1=68683&r2=68684
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Mon Jun 11 09:35:02 2007
@@ -977,19 +977,28 @@
 		if (!done) {
 			if (option_debug)
 				ast_log(LOG_DEBUG, "Avoiding %s for channel '%p'\n", msg, c);
+			if (retries == 9) {
+				/* We are about to fail due to a deadlock, so report this
+				 * while we still have the list lock.
+				 */
+				if (option_debug)
+					ast_log(LOG_DEBUG, "Failure, could not lock '%p' after %d retries!\n", c, retries);
+				/* As we have deadlocked, we will skip this channel and
+				 * see if there is another match.
+				 * NOTE: No point doing this for a full-name match,
+				 * as there can be no more matches.
+				 */
+				if (!(name && !namelen)) {
+					prev = c;
+					retries = -1;
+				}
+			}
 		}
 		AST_LIST_UNLOCK(&channels);
 		if (done)
 			return c;
 		usleep(1);	/* give other threads a chance before retrying */
 	}
-	/*
- 	 * c is surely not null, but we don't have the lock so cannot
-	 * access c->name
-	 */
-	if (option_debug)
-		ast_log(LOG_DEBUG, "Failure, could not lock '%p' after %d retries!\n",
-			c, retries);
 
 	return NULL;
 }



More information about the asterisk-commits mailing list