Minor cleanups

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1138 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.0
Mark Spencer 22 years ago
parent 40e4cfe458
commit 9b0526bb46

@ -1647,7 +1647,7 @@ int ast_readstring(struct ast_channel *c, char *s, int len, int timeout, int fti
if (!len) if (!len)
return -1; return -1;
do { do {
if (c->streamid > -1) { if (c->stream) {
d = ast_waitstream(c, AST_DIGIT_ANY); d = ast_waitstream(c, AST_DIGIT_ANY);
ast_stopstream(c); ast_stopstream(c);
usleep(1000); usleep(1000);
@ -1685,7 +1685,7 @@ int ast_readstring_full(struct ast_channel *c, char *s, int len, int timeout, in
if (!len) if (!len)
return -1; return -1;
do { do {
if (c->streamid > -1) { if (c->stream) {
d = ast_waitstream_full(c, AST_DIGIT_ANY, audiofd, ctrlfd); d = ast_waitstream_full(c, AST_DIGIT_ANY, audiofd, ctrlfd);
ast_stopstream(c); ast_stopstream(c);
usleep(1000); usleep(1000);

@ -826,8 +826,6 @@ char ast_waitstream(struct ast_channel *c, char *breakon)
ast_frfree(fr); ast_frfree(fr);
} }
ast_sched_runq(c->sched); ast_sched_runq(c->sched);
} }
return (c->_softhangup ? -1 : 0); return (c->_softhangup ? -1 : 0);
} }
@ -838,13 +836,15 @@ char ast_waitstream_fr(struct ast_channel *c, char *breakon, char *forward, char
struct ast_frame *fr; struct ast_frame *fr;
while(c->stream) { while(c->stream) {
res = ast_sched_wait(c->sched); res = ast_sched_wait(c->sched);
if (res < 0) { if ((res < 0) && !c->timingfunc) {
if (c->stream) if (c->stream)
ast_closestream(c->stream); ast_closestream(c->stream);
if (c->vstream) if (c->vstream)
ast_closestream(c->vstream); ast_closestream(c->vstream);
break; break;
} }
if (res < 0)
res = 1000;
res = ast_waitfor(c, res); res = ast_waitfor(c, res);
if (res < 0) { if (res < 0) {
ast_log(LOG_WARNING, "Select failed (%s)\n", strerror(errno)); ast_log(LOG_WARNING, "Select failed (%s)\n", strerror(errno));
@ -904,13 +904,15 @@ char ast_waitstream_full(struct ast_channel *c, char *breakon, int audiofd, int
while(c->stream) { while(c->stream) {
ms = ast_sched_wait(c->sched); ms = ast_sched_wait(c->sched);
if (ms < 0) { if ((ms < 0) && !c->timingfunc) {
if (c->stream) if (c->stream)
ast_closestream(c->stream); ast_closestream(c->stream);
if (c->vstream) if (c->vstream)
ast_closestream(c->vstream); ast_closestream(c->vstream);
break; break;
} }
if (ms < 0)
ms = 1000;
rchan = ast_waitfor_nandfds(&c, 1, &cmdfd, (cmdfd > -1) ? 1 : 0, NULL, &outfd, &ms); rchan = ast_waitfor_nandfds(&c, 1, &cmdfd, (cmdfd > -1) ? 1 : 0, NULL, &outfd, &ms);
if (!rchan && (outfd < 0) && (ms)) { if (!rchan && (outfd < 0) && (ms)) {
ast_log(LOG_WARNING, "Wait failed (%s)\n", strerror(errno)); ast_log(LOG_WARNING, "Wait failed (%s)\n", strerror(errno));

Loading…
Cancel
Save