* cygtls.cc (_cygtls::fixup_after_fork): Wipe out exitsock local since it

should not be used by the child.
* select.cc (start_thread_socket): Turn off inheritance for exitsock.  Don't
add exitsock to exception mask since it should never get an exception.
(socket_cleanup): Change some debug messages for consistency.
* fhandler_socket.cc (fhandler_socket::dup): Change comment wording slightly.
This commit is contained in:
Christopher Faylor 2004-10-26 21:13:50 +00:00
parent 3d43992262
commit 5957d504f0
4 changed files with 20 additions and 5 deletions

View File

@ -1,3 +1,14 @@
2004-10-26 Christopher Faylor <cgf@timesys.com>
* cygtls.cc (_cygtls::fixup_after_fork): Wipe out exitsock local since
it should not be used by the child.
* select.cc (start_thread_socket): Turn off inheritance for exitsock.
Don't add exitsock to exception mask since it should never get an
exception.
(socket_cleanup): Change some debug messages for consistency.
* fhandler_socket.cc (fhandler_socket::dup): Change comment wording
slightly.
2004-10-26 Pierre Humblet <pierre.humblet@ieee.org>
* registry.cc (get_registry_hive_path): Simplify and add a

View File

@ -149,6 +149,7 @@ _cygtls::fixup_after_fork ()
sig = 0;
}
stacklock = 0;
locals.exitsock = INVALID_SOCKET;
wq.thread_ev = NULL;
}

View File

@ -352,8 +352,8 @@ fhandler_socket::dup (fhandler_base *child)
debug_printf ("WSADuplicateSocket failed, trying DuplicateHandle");
}
/* We don't call fhandler_base::dup here since that requires to
have winsock called from fhandler_base and it creates only
/* We don't call fhandler_base::dup here since that requires
having winsock called from fhandler_base and it creates only
inheritable sockets which is wrong for winsock2. */
HANDLE nh;

View File

@ -1371,11 +1371,14 @@ start_thread_socket (select_record *me, select_stuff *stuff)
select_printf ("getsockname error");
goto err;
}
if (winsock2_active && wincap.has_set_handle_information ())
SetHandleInformation ((HANDLE) si->exitsock, HANDLE_FLAG_INHERIT, 0);
/* else
too bad? */
}
select_printf ("exitsock %p", si->exitsock);
WINSOCK_FD_SET ((HANDLE) si->exitsock, &si->readfds);
WINSOCK_FD_SET ((HANDLE) si->exitsock, &si->exceptfds);
stuff->device_specific_socket = (void *) si;
si->start = &stuff->start;
select_printf ("stuff_start %p", &stuff->start);
@ -1400,11 +1403,11 @@ socket_cleanup (select_record *, select_stuff *stuff)
int res = sendto (_my_tls.locals.exitsock, buf, 1, 0,
(sockaddr *) &_my_tls.locals.exitsock_sin,
sizeof (_my_tls.locals.exitsock_sin));
select_printf ("sent a byte to the exit sock %p, res %d", _my_tls.locals.exitsock, res);
select_printf ("sent a byte to exitsock %p, res %d", _my_tls.locals.exitsock, res);
/* Wait for thread to go away */
si->thread->detach ();
/* empty the socket */
select_printf ("reading a byte from %p", si->exitsock);
select_printf ("reading a byte from exitsock %p", si->exitsock);
res = recv (si->exitsock, buf, 1, 0);
select_printf ("recv returned %d", res);
stuff->device_specific_socket = NULL;