mms/tcp: hanging or unexpected seeking after the end of stream
authorbl4 <bl4@playker.info>
Sat, 24 May 2008 18:17:49 +0000 (20:17 +0200)
committerRafaël Carré <funman@videolan.org>
Mon, 26 May 2008 20:34:35 +0000 (22:34 +0200)
Signed-off-by: Rafaël Carré <funman@videolan.org>
modules/access/mms/mmstu.c
src/input/stream.c

index 7b41745..776f0c2 100644 (file)
@@ -400,6 +400,11 @@ static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
     size_t      i_data;
     size_t      i_copy;
 
+    if( p_access->info.b_eof )
+    {
+        return 0;
+    }
+
     i_data = 0;
 
     /* *** now send data if needed *** */
index 228fb87..94ec224 100644 (file)
@@ -1025,10 +1025,15 @@ static int AStreamReadStream( stream_t *s, void *p_read, int i_read )
         /* seek within this stream if possible, else use plain old read and discard */
         stream_sys_t *p_sys = s->p_sys;
         access_t     *p_access = p_sys->p_access;
-        bool   b_aseek;
-        access_Control( p_access, ACCESS_CAN_SEEK, &b_aseek );
-        if( b_aseek )
-            return AStreamSeekStream( s, p_sys->i_pos + i_read ) ? 0 : i_read;
+
+        /* seeking after EOF is not what we want */
+        if( !( p_access->info.b_eof ) )
+        {
+            bool   b_aseek;
+            access_Control( p_access, ACCESS_CAN_SEEK, &b_aseek );
+            if( b_aseek )
+                return AStreamSeekStream( s, p_sys->i_pos + i_read ) ? 0 : i_read;
+        }
     }
 
 #ifdef STREAM_DEBUG