[Asterisk-cvs] asterisk/channels chan_zap.c,1.153,1.154

markster at lists.digium.com markster at lists.digium.com
Thu Dec 11 15:03:55 CST 2003


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

Modified Files:
	chan_zap.c 
Log Message:
Properly fix double locking issue, fix wav49 issue


Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -d -r1.153 -r1.154
--- chan_zap.c	11 Dec 2003 18:01:03 -0000	1.153
+++ chan_zap.c	11 Dec 2003 20:55:26 -0000	1.154
@@ -3182,7 +3182,7 @@
 
 
 
-static struct ast_frame *zt_exception(struct ast_channel *ast)
+static struct ast_frame *__zt_exception(struct ast_channel *ast)
 {
 	struct zt_pvt *p = ast->pvt->pvt;
 	int res;
@@ -3190,7 +3190,6 @@
 	int index;
 	struct ast_frame *f;
 
-	ast_mutex_lock(&p->lock);
 
 	index = zt_get_index(ast, p, 1);
 	
@@ -3272,7 +3271,6 @@
 			ast_log(LOG_WARNING, "Don't know how to absorb event %s\n", event2str(res));
 		}
 		f = &p->subs[index].f;
-		ast_mutex_unlock(&p->lock);
 		return f;
 	}
 	if (!p->radio) ast_log(LOG_DEBUG, "Exception on %d, channel %d\n", ast->fds[0],p->channel);
@@ -3280,10 +3278,18 @@
 	if (ast != p->owner) {
 		ast_log(LOG_WARNING, "We're %s, not %s\n", ast->name, p->owner->name);
 		f = &p->subs[index].f;
-		ast_mutex_unlock(&p->lock);
 		return f;
 	}
 	f = zt_handle_event(ast);
+	return f;
+}
+
+struct ast_frame *zt_exception(struct ast_channel *ast)
+{
+	struct zt_pvt *p = ast->pvt->pvt;
+	struct ast_frame *f;
+	ast_mutex_lock(&p->lock);
+	f = __zt_exception(ast);
 	ast_mutex_unlock(&p->lock);
 	return f;
 }
@@ -3403,7 +3409,7 @@
 				ast_mutex_unlock(&p->lock);
 				return &p->subs[index].f;
 			} else if (errno == ELAST) {
-				f = zt_exception(ast);
+				f = __zt_exception(ast);
 			} else
 				ast_log(LOG_WARNING, "zt_rec: %s\n", strerror(errno));
 		}
@@ -3412,7 +3418,7 @@
 	}
 	if (res != (p->subs[index].linear ? READ_SIZE * 2 : READ_SIZE)) {
 		ast_log(LOG_DEBUG, "Short read (%d/%d), must be an event...\n", res, p->subs[index].linear ? READ_SIZE * 2 : READ_SIZE);
-		f = zt_exception(ast);
+		f = __zt_exception(ast);
 		ast_mutex_unlock(&p->lock);
 		return f;
 	}




More information about the svn-commits mailing list