]> git.sesse.net Git - vlc/commitdiff
Interrupt blocking socket reads
authorRémi Denis-Courmont <rem@videolan.org>
Thu, 19 Oct 2006 14:55:57 +0000 (14:55 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Thu, 19 Oct 2006 14:55:57 +0000 (14:55 +0000)
src/network/io.c

index 61f7f832b91a601e08d9b055641a311697200d82..027063b8dd787332ec5d924d14d547fbe9786f9f 100644 (file)
@@ -169,6 +169,12 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
         if( (wait_ms != -1) && (wait_ms < 500) )
             delay_ms = wait_ms;
 
+        if( p_this->b_die )
+        {
+            errno = EINTR;
+            goto error;
+        }
+
 #ifdef HAVE_POLL
         memset(ufd, 0, sizeof (ufd) );
 
@@ -178,10 +184,7 @@ net_ReadInner( vlc_object_t *restrict p_this, unsigned fdc, const int *fdv,
             ufd[i].events = POLLIN;
         }
 
-        if( p_this->b_die )
-            return i_total;
-
-        n = poll( ufd, fdc, (wait_ms == -1) ? -1 : delay_ms );
+        n = poll( ufd, fdc, delay_ms );
         if( n == -1 )
             goto error;