changeset 35018:5f3501f7f4d9

Explicitly signal EOF when reaching the end of a file/pipe. Fixes a 4 second delay due to stream_reconnect for e.g. echo | mplayer -
author reimar
date Wed, 22 Aug 2012 18:24:56 +0000
parents 2136289a9c39
children c879d6314c11
files stream/stream_file.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream_file.c	Tue Aug 21 08:39:16 2012 +0000
+++ b/stream/stream_file.c	Wed Aug 22 18:24:56 2012 +0000
@@ -56,6 +56,8 @@
 
 static int fill_buffer(stream_t *s, char* buffer, int max_len){
   int r = read(s->fd,buffer,max_len);
+  // We are certain this is EOF, do not retry
+  if (max_len && r == 0) s->eof = 1;
   return (r <= 0) ? -1 : r;
 }