changeset 2569:049f212e7e00

- Fix case where the prebuffering exhausts the stream, and all data is read on the first go
author Ralf Ertzinger <ralf@skytale.net>
date Fri, 16 May 2008 16:01:18 +0200
parents 92f6d0503c04
children 28498c0bde64 76924684ee4f
files src/neon/neon.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/neon/neon.c	Fri May 16 14:43:59 2008 +0200
+++ b/src/neon/neon.c	Fri May 16 16:01:18 2008 +0200
@@ -1134,9 +1134,16 @@
     /*
      * Signal the network thread to continue reading
      */
-    _DEBUG("<%p> Waking up reader thread", h);
     g_mutex_lock(h->reader_status.mutex);
-    g_cond_signal(h->reader_status.cond);
+    if (NEON_READER_EOF == h->reader_status.status) {
+        if (0 == free_rb_locked(&h->rb)) {
+            _DEBUG("<%p> stream EOF reached and buffer empty", h);
+            h->eof = TRUE;
+        }
+    } else {
+        _DEBUG("<%p> Waking up reader thread", h);
+        g_cond_signal(h->reader_status.cond);
+    }
     g_mutex_unlock(h->reader_status.mutex);
 
     h->pos += (relem*size);