[Asterisk-cvs] asterisk/channels chan_local.c,1.20,1.21

markster at lists.digium.com markster at lists.digium.com
Tue Dec 2 09:26:13 CST 2003


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv820/channels

Modified Files:
	chan_local.c 
Log Message:
Really fix chan local races (I hope)


Index: chan_local.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_local.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- chan_local.c	8 Oct 2003 02:21:09 -0000	1.20
+++ chan_local.c	2 Dec 2003 15:52:37 -0000	1.21
@@ -74,21 +74,25 @@
 static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_frame *f, struct ast_channel *us)
 {
 	struct ast_channel *other;
+retrylock:		
+	/* Recalculate outbound channel */
 	if (isoutbound) {
 		other = p->owner;
 	} else {
 		other = p->chan;
 	}
-	if (!other)
-		return 0;
+	/* Set glare detection */
 	p->glaredetect = 1;
-retrylock:		
 	if (p->cancelqueue) {
 		/* We had a glare on the hangup.  Forget all this business,
 		return and destroy p.  */
 		ast_mutex_unlock(&p->lock);
 		free(p);
 		return -1;
+	}
+	if (!other) {
+		p->glaredetect = 0;
+		return 0;
 	}
 	if (ast_mutex_trylock(&other->lock)) {
 		/* Failed to lock.  Release main lock and try again */




More information about the svn-commits mailing list