Commit faf91f1f authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Update to the 'gentle SIGHUP' patch. (ITS#1679)

- Let write operations return unwilling-to-perform after
  'gentle shutdown' has been initiated.
- Change -1 to 2 in slapd_gentle_shutdown and slapd_shutdown, since
  sig_atomic_t can be unsigned (ITS#1736).  The 'gentle SIGHUP' patch
  is older than ITS#1736 but was applied later, so it reintroduced
  the problem.

Hallvard B. Furuseth <h.b.furuseth@usit.uio.no>, June 2002.
parent c5c1ddb1
......@@ -208,7 +208,8 @@ disables StartTLS if authenticated (see also
A SIGHUP signal will only cause a 'gentle' shutdown-attempt:
.B Slapd
will stop listening for new connections, but will not close the
connections to the current clients. It terminates when all clients
connections to the current clients. Future write operations return
unwilling-to-perform, though. Slapd terminates when all clients
have closed their connections (if they ever do), or \- as before \-
if it receives a SIGTERM signal. This can be useful if you wish to
terminate the server and start a new
......
......@@ -237,7 +237,7 @@ void slapd_remove(ber_socket_t s, int wake) {
FD_CLR( s, &slap_daemon.sd_writers );
ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
WAKE_LISTENER(wake || slapd_gentle_shutdown < 0);
WAKE_LISTENER(wake || slapd_gentle_shutdown == 2);
}
void slapd_clr_write(ber_socket_t s, int wake) {
......@@ -1114,17 +1114,18 @@ slapd_daemon_task(
if( slapd_gentle_shutdown ) {
ber_socket_t active;
if( slapd_gentle_shutdown > 0 ) {
if( slapd_gentle_shutdown == 1 ) {
Debug( LDAP_DEBUG_ANY, "slapd gentle shutdown\n", 0, 0, 0 );
close_listeners( 1 );
slapd_gentle_shutdown = -1;
global_restrictops |= SLAP_RESTRICT_OP_WRITES;
slapd_gentle_shutdown = 2;
}
ldap_pvt_thread_mutex_lock( &slap_daemon.sd_mutex );
active = slap_daemon.sd_nactives;
ldap_pvt_thread_mutex_unlock( &slap_daemon.sd_mutex );
if( active == 0 ) {
slapd_shutdown = -1;
slapd_shutdown = 2;
break;
}
}
......@@ -1780,7 +1781,7 @@ slapd_daemon_task(
#endif
}
if( slapd_gentle_shutdown >= 0 )
if( slapd_gentle_shutdown != 2 )
close_listeners ( 0 );
free ( slap_listeners );
slap_listeners = NULL;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment