diff options
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/fhandler_socket.cc | 24 |
2 files changed, 19 insertions, 11 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 819b9b21c..7cba516f4 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,11 @@ 2004-04-01 Corinna Vinschen <corinna@vinschen.de> + * fhandler_socket.cc (fhandler_socket::recvfrom): Rearrange loop + so that WSARecvFrom is always called before waiting. + (fhandler_socket::recvmsg): Ditto. + +2004-04-01 Corinna Vinschen <corinna@vinschen.de> + * net.cc (wsock_event::wait): Make wsa_err an int. Don't set ret to 0 if any error has happened. diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 878880da0..7f028ba0b 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -737,14 +737,15 @@ fhandler_socket::recvfrom (void *ptr, size_t len, int flags, { do { - if (!(res = wsock_evt.wait (get_socket (), has_been_closed))) - res = WSARecvFrom (get_socket (), &wsabuf, 1, - (ret = 0, &ret), (DWORD *) &flags, - from, fromlen, NULL, NULL); + res = WSARecvFrom (get_socket (), &wsabuf, 1, + (ret = 0, &ret), (DWORD *) &flags, + from, fromlen, NULL, NULL); } while (res == SOCKET_ERROR && WSAGetLastError () == WSAEWOULDBLOCK - && !has_been_closed); + && !has_been_closed + && !(res = wsock_evt.wait (get_socket (), + has_been_closed))); wsock_evt.release (get_socket ()); } } @@ -863,14 +864,15 @@ fhandler_socket::recvmsg (struct msghdr *msg, int flags, ssize_t tot) { do { - if (!(res = wsock_evt.wait (get_socket (), has_been_closed))) - res = WSARecvFrom (get_socket (), wsabuf, iovcnt, - (ret = 0, &ret), (DWORD *) &flags, - from, fromlen, NULL, NULL); + res = WSARecvFrom (get_socket (), wsabuf, iovcnt, + (ret = 0, &ret), (DWORD *) &flags, + from, fromlen, NULL, NULL); } while (res == SOCKET_ERROR - && WSAGetLastError () == WSAEWOULDBLOCK - && !has_been_closed); + && WSAGetLastError () == WSAEWOULDBLOCK + && !has_been_closed + && !(res = wsock_evt.wait (get_socket (), + has_been_closed))); wsock_evt.release (get_socket ()); } } |