core: make sure win32 sockets remain blocking

Commit 7e344b5 hade the side effect of forcing every socket to
be non-blocking on Windows. This is because of a (documented)
side effect of WSAEventSelect(). So we need to make sure to restore
blocking behaviour afterwards for relevant sockets.
This commit is contained in:
Pierre Ossman 2013-09-20 10:10:50 +02:00 committed by Tanu Kaskinen
parent abfca5cb58
commit 0138a51a2c
3 changed files with 69 additions and 9 deletions

View file

@ -65,6 +65,8 @@ typedef unsigned long nfds_t;
#include <time.h>
#include <pulsecore/core-util.h>
#ifndef INFTIM
# define INFTIM (-1)
#endif
@ -602,6 +604,9 @@ restart:
/* It's a socket. */
WSAEnumNetworkEvents ((SOCKET) h, NULL, &ev);
WSAEventSelect ((SOCKET) h, 0, 0);
/* Have to restore blocking as WSAEventSelect() clears it */
if (!pa_is_fd_nonblock(pfd[i].fd))
pa_make_fd_block(pfd[i].fd);
/* If we're lucky, WSAEnumNetworkEvents already provided a way
to distinguish FD_READ and FD_ACCEPT; this saves a recv later. */