From c9d033ae30b8c0f6a5c063916151db898d2a9f96 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 15 Jan 2004 21:35:05 +0000 Subject: [PATCH] Fix syncrepl slapd_shutdown detection, would not stop on a gentlehup. --- servers/slapd/daemon.c | 3 --- servers/slapd/proto-slap.h | 1 + servers/slapd/syncrepl.c | 6 +++--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index d98ca7fe7b..97556de00e 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -83,9 +83,6 @@ static int waking; do { if (w) tcp_write( wake_sds[1], "0", 1 ); } while(0) #endif -#ifndef HAVE_WINSOCK -static -#endif volatile sig_atomic_t slapd_shutdown = 0, slapd_gentle_shutdown = 0; volatile sig_atomic_t slapd_abrupt_shutdown = 0; diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index b081f58ef6..11556fc0b7 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -419,6 +419,7 @@ LDAP_SLAPD_F (void) slapd_set_read LDAP_P((ber_socket_t s, int wake)); LDAP_SLAPD_F (void) slapd_clr_read LDAP_P((ber_socket_t s, int wake)); LDAP_SLAPD_V (volatile sig_atomic_t) slapd_abrupt_shutdown; +LDAP_SLAPD_V (volatile sig_atomic_t) slapd_shutdown; /* * dn.c diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 2a8a7b1e88..a77e2c6bcb 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -450,7 +450,7 @@ do_syncrep2( BerVarray syncUUIDs = NULL; ber_tag_t si_tag; - if ( slapd_abrupt_shutdown ) { + if ( slapd_shutdown ) { rc = -2; goto done; } @@ -477,7 +477,7 @@ do_syncrep2( while (( rc = ldap_result( si->si_ld, LDAP_RES_ANY, LDAP_MSG_ONE, tout_p, &res )) > 0 ) { - if ( slapd_abrupt_shutdown ) { + if ( slapd_shutdown ) { rc = -2; goto done; } @@ -797,7 +797,7 @@ do_syncrepl( return NULL; } - if ( slapd_abrupt_shutdown && si->si_ld ) { + if ( slapd_shutdown && si->si_ld ) { ldap_get_option( si->si_ld, LDAP_OPT_DESC, &s ); connection_client_stop( s ); ldap_unbind( si->si_ld ); -- 2.39.5