Also, Windows does not have a MSG_DONTWAIT. Get rid of it as we always use non-blocking sockets.
Co-authored-by: Linda Sun <l...@vmware.com> Signed-off-by: Linda Sun <l...@vmware.com> Signed-off-by: Gurucharan Shetty <gshe...@nicira.com> --- lib/socket-util.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/socket-util.c b/lib/socket-util.c index 3654951..b59ce65 100644 --- a/lib/socket-util.c +++ b/lib/socket-util.c @@ -223,15 +223,24 @@ check_connection_completion(int fd) int retval; pfd.fd = fd; +#ifndef _WIN32 pfd.events = POLLOUT; +#else + pfd.events = POLLWRNORM; +#endif + +#ifndef _WIN32 do { retval = poll(&pfd, 1, 0); } while (retval < 0 && errno == EINTR); +#else + retval = WSAPoll(&pfd, 1, 0); +#endif if (retval == 1) { if (pfd.revents & POLLERR) { - ssize_t n = send(fd, "", 1, MSG_DONTWAIT); + ssize_t n = send(fd, "", 1, 0); if (n < 0) { - return errno; + return sock_errno(); } else { VLOG_ERR_RL(&rl, "poll return POLLERR but send succeeded"); return EPROTO; @@ -239,7 +248,7 @@ check_connection_completion(int fd) } return 0; } else if (retval < 0) { - VLOG_ERR_RL(&rl, "poll: %s", ovs_strerror(errno)); + VLOG_ERR_RL(&rl, "poll: %s", sock_strerror(sock_errno())); return errno; } else { return EAGAIN; @@ -271,8 +280,7 @@ drain_rcvbuf(int fd) * On other Unix-like OSes, MSG_TRUNC has no effect in the flags * argument. */ char buffer[LINUX_DATAPATH ? 1 : 2048]; - ssize_t n_bytes = recv(fd, buffer, sizeof buffer, - MSG_TRUNC | MSG_DONTWAIT); + ssize_t n_bytes = recv(fd, buffer, sizeof buffer, MSG_TRUNC); if (n_bytes <= 0 || n_bytes >= rcvbuf) { break; } -- 1.7.9.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev