[asterisk-commits] branch 1.2 - r7269
/branches/1.2/apps/app_festival.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Dec 1 17:49:45 CST 2005
Author: kpfleming
Date: Thu Dec 1 17:49:44 2005
New Revision: 7269
URL: http://svn.digium.com/view/asterisk?rev=7269&view=rev
Log:
don't block waiting for the Festival server forever when it goes away (issue #5882)
Modified:
branches/1.2/apps/app_festival.c
Modified: branches/1.2/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_festival.c?rev=7269&r1=7268&r2=7269&view=diff
==============================================================================
--- branches/1.2/apps/app_festival.c (original)
+++ branches/1.2/apps/app_festival.c Thu Dec 1 17:49:44 2005
@@ -455,8 +455,20 @@
/* 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");
More information about the asterisk-commits
mailing list