aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_zap.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-10-14 09:56:46 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-10-14 09:56:46 +0000
commita8b23b8dec13dea8881c89b8ab138f6fb1b7dcd0 (patch)
tree8a52d46dcfd98436c12c404abcc78acf9b2cd145 /channels/chan_zap.c
parent5c4b223d3e3797265e857f97bd4109204f1fab6a (diff)
Properly handle events during reads
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1630 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_zap.c')
-rwxr-xr-xchannels/chan_zap.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 75bead1c1..945b54b09 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);