4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-18 04:19:21 +08:00

* fhandler_socket.cc (fhandler_socket::recvfrom): Rearrange loop

so that WSARecvFrom is always called before waiting.
	(fhandler_socket::recvmsg): Ditto.
This commit is contained in:
Corinna Vinschen 2004-04-01 17:00:21 +00:00
parent 4cfacffa79
commit b6edea61f2
2 changed files with 19 additions and 11 deletions

View File

@ -1,3 +1,9 @@
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

View File

@ -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);
}
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);
}
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 ());
}
}