[vlc-commits] Windows store: don't call read() before poll() on network sockets

Rafaël Carré git at videolan.org
Fri Oct 25 12:27:30 CEST 2013


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Mon Oct 21 19:41:28 2013 +0200| [f8b16acbcb34d42962bb040fd77fbca3bca1fe3f] | committer: Rafaël Carré

Windows store: don't call read() before poll() on network sockets

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f8b16acbcb34d42962bb040fd77fbca3bca1fe3f
---

 src/network/io.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/network/io.c b/src/network/io.c
index dc5ef12..6cadffa 100644
--- a/src/network/io.c
+++ b/src/network/io.c
@@ -268,6 +268,17 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
     ufd[1].events = POLLIN;
 
     size_t i_total = 0;
+#if VLC_WINSTORE_APP
+    /* With winrtsock winsocks emulation library, the first call to read()
+     * before poll() starts an asynchronous transfer and returns 0.
+     * Always call poll() first.
+     *
+     * However if we have a virtual socket handler, try to read() first.
+     * See bug #8972 for details.
+     */
+    if (vs == NULL)
+        goto do_poll;
+#endif
     do
     {
         ssize_t n;
@@ -325,7 +336,9 @@ net_Read (vlc_object_t *restrict p_this, int fd, const v_socket_t *vs,
             errno = EINTR;
             return -1;
         }
-
+#if VLC_WINSTORE_APP
+do_poll:
+#endif
         /* Wait for more data */
         if (poll (ufd, sizeof (ufd) / sizeof (ufd[0]), -1) < 0)
         {



More information about the vlc-commits mailing list