[Asterisk-cvs] asterisk/channels chan_zap.c,1.151,1.152

markster at lists.digium.com markster at lists.digium.com
Thu Dec 11 10:45:02 CST 2003


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

Modified Files:
	chan_zap.c 
Log Message:
Properly handle exceptions in zt_read


Index: chan_zap.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_zap.c,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -d -r1.151 -r1.152
--- chan_zap.c	9 Dec 2003 23:55:17 -0000	1.151
+++ chan_zap.c	11 Dec 2003 16:36:33 -0000	1.152
@@ -3180,7 +3180,9 @@
 	return &p->subs[index].f;
  }
 
-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;
@@ -3286,6 +3288,16 @@
 	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;
+}
+
 struct ast_frame  *zt_read(struct ast_channel *ast)
 {
 	struct zt_pvt *p = ast->pvt->pvt;
@@ -3401,7 +3413,7 @@
 				ast_mutex_unlock(&p->lock);
 				return &p->subs[index].f;
 			} else if (errno == ELAST) {
-				f = zt_handle_event(ast);
+				f = __zt_exception(ast);
 			} else
 				ast_log(LOG_WARNING, "zt_rec: %s\n", strerror(errno));
 		}
@@ -3410,7 +3422,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_handle_event(ast);
+		f = __zt_exception(ast);
 		ast_mutex_unlock(&p->lock);
 		return f;
 	}




More information about the svn-commits mailing list