From 2bf8b3838368837e6096d07f00f3c01a4b7af51a Mon Sep 17 00:00:00 2001 From: Mark Spencer <markster@digium.com> Date: Tue, 14 Oct 2003 09:56:46 +0000 Subject: [PATCH] Properly handle events during reads git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1630 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_zap.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/channels/chan_zap.c b/channels/chan_zap.c index 75bead1c11..945b54b098 100755 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -3322,16 +3322,19 @@ struct ast_frame *zt_read(struct ast_channel *ast) ast->blocking = 0; /* Check for hangup */ if (res < 0) { + f = NULL; if (res == -1) { if (errno == EAGAIN) { /* Return "NULL" frame if there is nobody there */ ast_mutex_unlock(&p->lock); return &p->subs[index].f; + } else if (errno == ELAST) { + f = zt_handle_event(ast); } else ast_log(LOG_WARNING, "zt_rec: %s\n", strerror(errno)); } ast_mutex_unlock(&p->lock); - return NULL; + return f; } 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); -- GitLab