summaryrefslogtreecommitdiff
path: root/main/channel.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2008-08-07 19:54:27 +0000
committerMark Michelson <mmichelson@digium.com>2008-08-07 19:54:27 +0000
commit9b5b8246c566d6fc30cf3ef68701fcc1981defc2 (patch)
tree1e0a81a9404b0744d8000966b8e877ec5dbc6006 /main/channel.c
parented4e6bf52bfa76563ce23f5fd20c2246496a31e1 (diff)
Fix a calculation error I had made in the poll. The poll
would reset to 500 ms every time a non-voice frame was received. The total time we poll should be 500 ms, so now we save the amount of time left after the poll returned and use that as our argument for the next call to poll git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@136633 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/channel.c')
-rw-r--r--main/channel.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/main/channel.c b/main/channel.c
index 2ab138279..f23ccc5c4 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -1679,17 +1679,20 @@ int __ast_answer(struct ast_channel *chan, unsigned int delay)
ast_safe_sleep(chan, delay);
else {
struct ast_frame *f;
+ int ms = ANSWER_WAIT_MS;
while (1) {
/* 500 ms was the original delay here, so now
* we cap our waiting at 500 ms
*/
- res = ast_waitfor(chan, ANSWER_WAIT_MS);
- if (res < 0) {
+ ms = ast_waitfor(chan, ms);
+ if (ms < 0) {
ast_log(LOG_WARNING, "Error condition occurred when polling channel %s for a voice frame: %s\n", chan->name, strerror(errno));
+ res = -1;
break;
}
- if (res == 0) {
+ if (ms == 0) {
ast_debug(2, "Didn't receive a voice frame from %s within %d ms of answering. Continuing anyway\n", chan->name, ANSWER_WAIT_MS);
+ res = 0;
break;
}
f = ast_read(chan);