- if (i_total > 0)
- {
- /* Errors (-1) and EOF (0) will be returned on next call,
- * otherwise we'd "hide" the error from the caller, which is a
- * bad idea™. */
- if (ufd[0].revents & (POLLERR|POLLNVAL))
- break;
- if (ufd[1].revents)
- break;
- }
- else
- {
- if (ufd[1].revents)
- {
- assert (p_this->b_die);
- msg_Dbg (p_this, "socket %d polling interrupted", fd);
-#if defined(WIN32)
- WSASetLastError (WSAEINTR);
-#else
- errno = EINTR;
+ 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;