diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-12-01 23:49:44 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2005-12-01 23:49:44 +0000 |
commit | d4a94dacb670519b35bc6db0729005d9082418f4 (patch) | |
tree | 4090972f683e3201b723de23994b64a5c64f1d97 /apps/app_festival.c | |
parent | c837ef2f4eba3b890a0e7792dccb1e5ac327733a (diff) |
don't block waiting for the Festival server forever when it goes away (issue #5882)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@7269 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_festival.c')
-rw-r--r-- | apps/app_festival.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/app_festival.c b/apps/app_festival.c index 03753642c..186a50ae7 100644 --- a/apps/app_festival.c +++ b/apps/app_festival.c @@ -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 */ wave = 0; do { + int read_data; 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'; if (strcmp(ack,"WV\n") == 0) { /* receive a waveform */ ast_log(LOG_DEBUG,"Festival WV command\n"); |