aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_zap.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_zap.c')
-rwxr-xr-xchannels/chan_zap.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index 5f7025097..ff9a48ef4 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -3182,7 +3182,7 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
-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 @@ static struct ast_frame *zt_exception(struct ast_channel *ast)
int index;
struct ast_frame *f;
- ast_mutex_lock(&p->lock);
index = zt_get_index(ast, p, 1);
@@ -3272,7 +3271,6 @@ static struct ast_frame *zt_exception(struct ast_channel *ast)
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 @@ static struct ast_frame *zt_exception(struct ast_channel *ast)
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 @@ 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_exception(ast);
+ f = __zt_exception(ast);
} else
ast_log(LOG_WARNING, "zt_rec: %s\n", strerror(errno));
}
@@ -3412,7 +3418,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_exception(ast);
+ f = __zt_exception(ast);
ast_mutex_unlock(&p->lock);
return f;
}