2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

windows: WSAPoll broken on windows

Unfortunately, WSAPoll misbehaves on Windows please view detailed behavior
on: https://github.com/openvswitch/ovs-issues/issues/117

We replace the WSAPoll with select looking only for errors and write events.

Reported-at: https://github.com/openvswitch/ovs-issues/issues/117
Reported-by: Yin Lin <linyi@vmware.com>
Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Sairam Venugopal <vsairam@vmware.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
This commit is contained in:
Alin Serdean
2016-12-16 02:50:28 +00:00
committed by Gurucharan Shetty
parent 0bc60d7ae5
commit ff792c6ac7

View File

@@ -253,7 +253,23 @@ check_connection_completion(int fd)
retval = poll(&pfd, 1, 0);
} while (retval < 0 && errno == EINTR);
#else
retval = WSAPoll(&pfd, 1, 0);
fd_set wrset, exset;
FD_ZERO(&wrset);
FD_ZERO(&exset);
FD_SET(fd, &exset);
FD_SET(fd, &wrset);
pfd.revents = 0;
struct timeval tv = { 0, 0 };
/* WSAPoll is broken on Windows, instead do a select */
retval = select(0, NULL, &wrset, &exset, &tv);
if (retval == 1) {
if (FD_ISSET(fd, &wrset)) {
pfd.revents |= pfd.events;
}
if (FD_ISSET(fd, &exset)) {
pfd.revents |= POLLERR;
}
}
#endif
if (retval == 1) {
if (pfd.revents & POLLERR) {