[xiph-commits] r16527 - in trunk/ezstream: . src

moritz at svn.xiph.org moritz at svn.xiph.org
Sat Aug 29 02:36:18 PDT 2009


Author: moritz
Date: 2009-08-29 02:36:18 -0700 (Sat, 29 Aug 2009)
New Revision: 16527

Modified:
   trunk/ezstream/NEWS
   trunk/ezstream/src/ezstream.c
Log:
The original reason to abort ezstream when running into problems opening a media
file was to prevent a very verbose infinite loop (e.g. when accidentially
playing an outdated playlist.) Bring that back by aborting after 100 subsequent
errors.


Modified: trunk/ezstream/NEWS
===================================================================
--- trunk/ezstream/NEWS	2009-08-29 09:14:12 UTC (rev 16526)
+++ trunk/ezstream/NEWS	2009-08-29 09:36:18 UTC (rev 16527)
@@ -5,6 +5,8 @@
              Failure to open a resource (e.g. a media file) is no longer fatal
              and operation will continue as far as possible. Idea from dhorton.
              (Ticket #1585)
+   - [MISC]  With the previous change, still abort ezstream after 100
+             subsequent errors to prevent a very verbose infinite loop.
  * src/playlist.c:
    - [MISC]  Consider no output from a playlist program to be equivalent to an
              empty line, indicating that the end of the playlist is reached.

Modified: trunk/ezstream/src/ezstream.c
===================================================================
--- trunk/ezstream/src/ezstream.c	2009-08-29 09:14:12 UTC (rev 16526)
+++ trunk/ezstream/src/ezstream.c	2009-08-29 09:36:18 UTC (rev 16527)
@@ -57,6 +57,7 @@
 EZCONFIG		*pezConfig = NULL;
 playlist_t		*playlist = NULL;
 int			 playlistMode = 0;
+unsigned int		 resource_errors = 0;
 
 #ifdef HAVE_SIGNALS
 const int		 ezstream_signals[] = {
@@ -874,9 +875,15 @@
 
 	if ((filepstream = openResource(shout, fileName, &popenFlag,
 					&mdata, &isStdin, &songLen))
-	    == NULL)
+	    == NULL) {
+		if (++resource_errors > 100) {
+			printf("%s: Too many errors -- giving up.\n", __progname);
+			return (0);
+		}
 		/* Continue with next resource on failure: */
 		return (1);
+	}
+	resource_errors = 0;
 
 	if (mdata != NULL) {
 		char	*tmp, *metaData;



More information about the commits mailing list