]> git.sesse.net Git - vlc/commitdiff
Simplify EOF handling
authorRémi Denis-Courmont <rem@videolan.org>
Thu, 19 Oct 2006 15:07:43 +0000 (15:07 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Thu, 19 Oct 2006 15:07:43 +0000 (15:07 +0000)
src/network/io.c

index 8a814f02510e6e55dffd88657d9ed316fc6fc88d..14b093dfa71b8394e4a2b5ea195a99931e557c3d 100644 (file)
@@ -134,9 +134,6 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
                int wait_ms, vlc_bool_t waitall )
 {
     size_t i_total = 0;
-    int eof[fdc];
-    unsigned int i_eof = 0;
-    memset( eof, 0, sizeof( eof ) );
 
     do
     {
@@ -152,9 +149,6 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
         if( i_buflen == 0 )
             return i_total; // output buffer full
 
-        if( i_eof == fdc )
-            return i_total; // all sockets are at EOF
-
         delay_ms = 500;
         if( (wait_ms != -1) && (wait_ms < 500) )
             delay_ms = wait_ms;
@@ -271,18 +265,13 @@ receive:
             goto error;
         }
 
+        if (n == 0) // EOF
+            return i_total;
+
         i_total += n;
         p_buf += n;
         i_buflen -= n;
 
-        if( n ==  0 ) // EOF on socket
-        {
-            unsigned int j;
-            for( j = 0 ; j < i_eof ; j++ )
-                if( eof[j] == *fdv ) goto end;
-            eof[i_eof++] = *fdv;
-        }
-end:
         if( wait_ms == -1 )
         {
             if( !waitall )