Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/select.cc')
-rw-r--r--winsup/cygwin/select.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc
index 683b93a5f..db59e5834 100644
--- a/winsup/cygwin/select.cc
+++ b/winsup/cygwin/select.cc
@@ -1329,6 +1329,11 @@ socket_cleanup (select_record *, select_stuff *stuff)
{
select_printf ("connection to si->exitsock %p", si->exitsock);
SOCKET s = socket (AF_INET, SOCK_STREAM, 0);
+
+ /* Set LINGER with 0 timeout for hard close */
+ struct linger tmp = {1, 0}; /* On, 0 delay */
+ (void) setsockopt (s, SOL_SOCKET, SO_LINGER, (char *)&tmp, sizeof(tmp));
+
/* Connecting to si->exitsock will cause any executing select to wake
up. When this happens then the exitsock condition will cause the
thread to terminate. */
@@ -1338,12 +1343,12 @@ socket_cleanup (select_record *, select_stuff *stuff)
select_printf ("connect failed");
/* FIXME: now what? */
}
- shutdown (s, 2);
+ shutdown (s, SD_BOTH);
closesocket (s);
/* Wait for thread to go away */
WaitForSingleObject (si->thread, INFINITE);
- shutdown (si->exitsock, 2);
+ shutdown (si->exitsock, SD_BOTH);
closesocket (si->exitsock);
CloseHandle (si->thread);
stuff->device_specific[FHDEVN(FH_SOCKET)] = NULL;