mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-30 13:30:57 +08:00
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.
This commit is contained in:
parent
c5c1ddb1ca
commit
faf91f1f1f
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user