summaryrefslogtreecommitdiff
path: root/channels/chan_zap.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2003-12-11 16:36:33 +0000
committerMark Spencer <markster@digium.com>2003-12-11 16:36:33 +0000
commit1540cd05a97c95c9fc01b9bf8c6130682cc7db10 (patch)
tree87aa79b05ce9322d8cbf4d03484c87b9f5e4f5fd /channels/chan_zap.c
parentc3b80c117f3f542bc80015da1b294546091a0114 (diff)
Properly handle exceptions in zt_read
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1853 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_zap.c')
-rwxr-xr-xchannels/chan_zap.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index ffeedc19f..eb8e9cb3f 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -3180,7 +3180,9 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
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 @@ struct ast_frame *zt_exception(struct ast_channel *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;
+}
+
struct ast_frame *zt_read(struct ast_channel *ast)
{
struct zt_pvt *p = ast->pvt->pvt;
@@ -3401,7 +3413,7 @@ struct ast_frame *zt_read(struct ast_channel *ast)
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 @@ struct ast_frame *zt_read(struct ast_channel *ast)
}
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;
}