[asterisk-commits] tilghman: branch 1.4 r60847 - in /branches/1.4: ./ channels/chan_local.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Apr 8 19:42:49 MST 2007


Author: tilghman
Date: Sun Apr  8 21:42:48 2007
New Revision: 60847

URL: http://svn.digium.com/view/asterisk?view=rev&rev=60847
Log:
Merged revisions 60846 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r60846 | tilghman | 2007-04-08 21:37:18 -0500 (Sun, 08 Apr 2007) | 2 lines

Bug 9505 - If the return value for local_queue_frame is set, then p->lock is no longer valid.

........

Modified:
    branches/1.4/   (props changed)
    branches/1.4/channels/chan_local.c

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

Modified: branches/1.4/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_local.c?view=diff&rev=60847&r1=60846&r2=60847
==============================================================================
--- branches/1.4/channels/chan_local.c (original)
+++ branches/1.4/channels/chan_local.c Sun Apr  8 21:42:48 2007
@@ -214,7 +214,8 @@
 		res = local_queue_frame(p, isoutbound, &answer, ast);
 	} else
 		ast_log(LOG_WARNING, "Huh?  Local is being asked to answer?\n");
-	ast_mutex_unlock(&p->lock);
+	if (!res)
+		ast_mutex_unlock(&p->lock);
 	return res;
 }
 
@@ -294,7 +295,8 @@
 			ast_log(LOG_DEBUG, "Not posting to queue since already masked on '%s'\n", ast->name);
 		res = 0;
 	}
-	ast_mutex_unlock(&p->lock);
+	if (!res)
+		ast_mutex_unlock(&p->lock);
 	return res;
 }
 
@@ -342,8 +344,8 @@
 		f.subclass = condition;
 		f.data = (void*)data;
 		f.datalen = datalen;
-		res = local_queue_frame(p, isoutbound, &f, ast);
-		ast_mutex_unlock(&p->lock);
+		if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
+			ast_mutex_unlock(&p->lock);
 	}
 
 	return res;
@@ -362,8 +364,8 @@
 	ast_mutex_lock(&p->lock);
 	isoutbound = IS_OUTBOUND(ast, p);
 	f.subclass = digit;
-	res = local_queue_frame(p, isoutbound, &f, ast);
-	ast_mutex_unlock(&p->lock);
+	if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
+		ast_mutex_unlock(&p->lock);
 
 	return res;
 }
@@ -382,9 +384,9 @@
 	isoutbound = IS_OUTBOUND(ast, p);
 	f.subclass = digit;
 	f.len = duration;
-	res = local_queue_frame(p, isoutbound, &f, ast);
-	ast_mutex_unlock(&p->lock);
-	
+	if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
+		ast_mutex_unlock(&p->lock);
+
 	return res;
 }
 
@@ -402,8 +404,8 @@
 	isoutbound = IS_OUTBOUND(ast, p);
 	f.data = (char *) text;
 	f.datalen = strlen(text) + 1;
-	res = local_queue_frame(p, isoutbound, &f, ast);
-	ast_mutex_unlock(&p->lock);
+	if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
+		ast_mutex_unlock(&p->lock);
 	return res;
 }
 
@@ -422,8 +424,8 @@
 	f.subclass = subclass;
 	f.data = (char *)data;
 	f.datalen = datalen;
-	res = local_queue_frame(p, isoutbound, &f, ast);
-	ast_mutex_unlock(&p->lock);
+	if (!(res = local_queue_frame(p, isoutbound, &f, ast)))
+		ast_mutex_unlock(&p->lock);
 	return res;
 }
 
@@ -477,7 +479,7 @@
 	int isoutbound;
 	struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP };
 	struct ast_channel *ochan = NULL;
-	int glaredetect = 0;
+	int glaredetect = 0, res = 0;
 
 	if (!p)
 		return -1;
@@ -524,8 +526,9 @@
 		/* Need to actually hangup since there is no PBX */
 		ochan = p->chan;
 	else
-		local_queue_frame(p, isoutbound, &f, NULL);
-	ast_mutex_unlock(&p->lock);
+		res = local_queue_frame(p, isoutbound, &f, NULL);
+	if (!res)
+		ast_mutex_unlock(&p->lock);
 	if (ochan)
 		ast_hangup(ochan);
 	return 0;



More information about the asterisk-commits mailing list