4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-18 12:29:32 +08:00

* fhandler_socket.cc (fhandler_socket::close): Respond to signals while

looping, waiting for socket to close.  Superstitiously clear last error when
WSAEWOULDBLOCK.
This commit is contained in:
Christopher Faylor 2002-03-05 18:02:53 +00:00
parent 241a7c5a8c
commit eeac69d835
2 changed files with 20 additions and 6 deletions

View File

@ -1,3 +1,9 @@
2002-03-05 Christopher Faylor <cgf@redhat.com>
* fhandler_socket.cc (fhandler_socket::close): Respond to signals while
looping, waiting for socket to close. Superstitiously clear last error
when WSAEWOULDBLOCK.
2002-03-05 Robert Collins <rbtcollins@hotmail.com>
* cygserver_transport_pipes.cc (transport_layer_pipes::transport_layer_pipes):

View File

@ -352,13 +352,21 @@ fhandler_socket::close ()
setsockopt (get_socket (), SOL_SOCKET, SO_LINGER,
(const char *)&linger, sizeof linger);
while ((res = closesocket (get_socket ()))
&& WSAGetLastError () == WSAEWOULDBLOCK)
continue;
if (res)
while ((res = closesocket (get_socket ())) != 0)
{
set_winsock_errno ();
res = -1;
if (WSAGetLastError () != WSAEWOULDBLOCK)
{
set_winsock_errno ();
res = -1;
break;
}
if (WaitForSingleObject (signal_arrived, 10) == WAIT_OBJECT_0)
{
set_errno (EINTR);
res = -1;
break;
}
WSASetLastError (0);
}
close_secret_event ();