From 22e981eef3a9213de9db1a34f845dc2bfcdfaf02 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 4 Jun 1999 21:42:25 +0000 Subject: [PATCH] Close hit socket. --- servers/slapd/daemon.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index a0f6a0b11b..b620aaa0b8 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -712,15 +712,24 @@ void hit_socket( void ) /* throw something at the socket to terminate the select() in the daemon thread. */ if (( s = socket( AF_INET, SOCK_STREAM, 0 )) == INVALID_SOCKET ) - Debug( LDAP_DEBUG_TRACE, "slap_set_shutdown: socket failed\n\tWSAGetLastError=%d (%s)\n", WSAGetLastError(), WSAGetLastErrorString(), 0 ); + Debug( LDAP_DEBUG_TRACE, + "slap_set_shutdown: socket failed\n\tWSAGetLastError=%d (%s)\n", + WSAGetLastError(), WSAGetLastErrorString(), 0 ); + if ( ioctlsocket( s, FIONBIO, &on ) == -1 ) - Debug( LDAP_DEBUG_TRACE, "slap_set_shutdown:FIONBIO ioctl on %d faled\n\tWSAGetLastError=%d (%s)\n", s, WSAGetLastError(), WSAGetLastError() ); + Debug( LDAP_DEBUG_TRACE, + "slap_set_shutdown:FIONBIO ioctl on %d faled\n\tWSAGetLastError=%d (%s)\n", + s, WSAGetLastError(), WSAGetLastError() ); bind_addr.sin_addr.s_addr = htonl( INADDR_LOOPBACK ); + if ( connect( s, (struct sockaddr *)&bind_addr, sizeof( struct sockaddr_in )) == SOCKET_ERROR ) { /* we can probably expect some error to occur here, mostly WSAEWOULDBLOCK */ } + + tcp_close(s); } + #elif HAVE_WINSOCK void sockinit() { WSADATA wsaData; -- 2.39.5