[vlc-devel] [PATCH] net_Read: don't exit loop if first read returned 0

Rafaël Carré funman at videolan.org
Wed Sep 18 22:15:45 CEST 2013


Wait until poll() signaled that data is available
---
 src/network/io.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/network/io.c b/src/network/io.c
index a8ea870..42cd732 100644
--- a/src/network/io.c
+++ b/src/network/io.c
@@ -264,6 +264,7 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
 
     ufd[0].fd = fd;
     ufd[0].events = POLLIN;
+    ufd[0].revents = 0;
     ufd[1].fd = vlc_object_waitpipe (p_this);
     ufd[1].events = POLLIN;
 
@@ -317,7 +318,7 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
             if (!waitall || i_buflen == 0)
                 break;
         }
-        else /* n == 0 */
+        else if (ufd[0].revents) /* n == 0 */
             break;/* end of stream or empty packet */
 
         if (ufd[1].fd == -1)
-- 
1.8.1.2




More information about the vlc-devel mailing list