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
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) {
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;
}
}
#endif
}
- if( slapd_gentle_shutdown >= 0 )
+ if( slapd_gentle_shutdown != 2 )
close_listeners ( 0 );
free ( slap_listeners );
slap_listeners = NULL;