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. Signed-off-by: Alin Gabriel Serdean <[email protected]> Reported-at: https://github.com/openvswitch/ovs-issues/issues/117 Reported-by: Yin Lin <[email protected]> --- lib/socket-util.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/socket-util.c b/lib/socket-util.c index 5a36f3b..2c0f1e6 100644 --- a/lib/socket-util.c +++ b/lib/socket-util.c @@ -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) { -- 2.10.2.windows.1 _______________________________________________ dev mailing list [email protected] https://mail.openvswitch.org/mailman/listinfo/ovs-dev
