mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-10 20:08:16 +00:00
don't block waiting for the Festival server forever when it goes away (issue #5882)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@7269 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -455,8 +455,20 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
|
|||||||
/* This assumes only one waveform will come back, also LP is unlikely */
|
/* This assumes only one waveform will come back, also LP is unlikely */
|
||||||
wave = 0;
|
wave = 0;
|
||||||
do {
|
do {
|
||||||
|
int read_data;
|
||||||
for (n=0; n < 3; )
|
for (n=0; n < 3; )
|
||||||
n += read(fd,ack+n,3-n);
|
{
|
||||||
|
read_data = read(fd,ack+n,3-n);
|
||||||
|
/* this avoids falling in infinite loop
|
||||||
|
* in case that festival server goes down
|
||||||
|
* */
|
||||||
|
if ( read_data == -1 )
|
||||||
|
{
|
||||||
|
ast_log(LOG_WARNING,"Unable to read from cache/festival fd");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
n += read_data;
|
||||||
|
}
|
||||||
ack[3] = '\0';
|
ack[3] = '\0';
|
||||||
if (strcmp(ack,"WV\n") == 0) { /* receive a waveform */
|
if (strcmp(ack,"WV\n") == 0) { /* receive a waveform */
|
||||||
ast_log(LOG_DEBUG,"Festival WV command\n");
|
ast_log(LOG_DEBUG,"Festival WV command\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user