[vlc-devel] [PATCH] Windows store: don't call read() before poll() on network sockets
Rafaël Carré
funman at videolan.org
Mon Oct 21 15:05:01 CEST 2013
---
src/network/io.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/src/network/io.c b/src/network/io.c
index dc5ef12..1f1e58b 100644
--- a/src/network/io.c
+++ b/src/network/io.c
@@ -268,6 +268,13 @@ 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.
+ */
+ goto do_poll;
+#endif
do
{
ssize_t n;
@@ -325,7 +332,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)
{
--
1.8.3.2
More information about the vlc-devel
mailing list