diff options
author | Joshua Colp <jcolp@digium.com> | 2017-02-03 05:32:26 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2017-02-03 05:32:26 -0600 |
commit | 9e05379f6528fad9bc608b82fbc20bb4e7831ca4 (patch) | |
tree | b32c22787ca833e74c19c96bfc44fb625caad8f7 | |
parent | 69fba558383e8b8b2ea1175707c7adef24813d3d (diff) | |
parent | 50029f585ece50a133180410b6c8fff66ad48e72 (diff) |
Merge "channel.c: Fix unbalanced read queue deadlocking local channels."
-rw-r--r-- | main/channel.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/main/channel.c b/main/channel.c index 1c7743a2f..234919336 100644 --- a/main/channel.c +++ b/main/channel.c @@ -1148,6 +1148,9 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in } AST_LIST_REMOVE_CURRENT(frame_list); ast_frfree(cur); + + /* Read from the alert pipe for each flushed frame. */ + ast_channel_internal_alert_read(chan); } } AST_LIST_TRAVERSE_SAFE_END; @@ -1164,9 +1167,13 @@ static int __ast_queue_frame(struct ast_channel *chan, struct ast_frame *fin, in } if (ast_channel_alert_writable(chan)) { - if (ast_channel_alert_write(chan)) { - ast_log(LOG_WARNING, "Unable to write to alert pipe on %s (qlen = %u): %s!\n", - ast_channel_name(chan), queued_frames, strerror(errno)); + /* Write to the alert pipe for each added frame */ + while (new_frames--) { + if (ast_channel_alert_write(chan)) { + ast_log(LOG_WARNING, "Unable to write to alert pipe on %s (qlen = %u): %s!\n", + ast_channel_name(chan), queued_frames, strerror(errno)); + break; + } } } else if (ast_channel_timingfd(chan) > -1) { ast_timer_enable_continuous(ast_channel_timer(chan)); |