changeset 32890:96340f2c8c17

Improve stream reset on read error, should now fix bug #1841 in more cases, e.g. also with -cache.
author reimar
date Sun, 27 Feb 2011 14:32:24 +0000
parents db45f9bd690d
children 744741d2607a
files stream/stream.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/stream/stream.c	Sun Feb 27 10:30:04 2011 +0000
+++ b/stream/stream.c	Sun Feb 27 14:32:24 2011 +0000
@@ -309,9 +309,14 @@
     if (!s->eof) {
       // just in case this is an error e.g. due to network
       // timeout reset and retry
+      // Seeking is used as a hack to make network streams
+      // reopen the connection, ideally they would implement
+      // e.g. a STREAM_CTRL_RECONNECT to do this
       off_t pos = s->pos;
+      s->eof=1;
       stream_reset(s);
       stream_seek_internal(s, pos);
+      // make sure EOF is set to ensure no endless loops
       s->eof=1;
       return stream_read_internal(s, buf, orig_len);
     }