mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-24 13:24:56 +08:00
fix for persistent search termination (ITS#2724)
- the consumer slapd did not terminate when the provider is alive - use a timeout in ldap_result() of syncrepl.c
This commit is contained in:
parent
d336d7783b
commit
537ccc3f5f
@ -68,6 +68,7 @@ do { if (w) tcp_write( wake_sds[1], "0", 1 ); } while(0)
|
||||
static
|
||||
#endif
|
||||
volatile sig_atomic_t slapd_shutdown = 0, slapd_gentle_shutdown = 0;
|
||||
volatile sig_atomic_t slapd_abrupt_shutdown = 0;
|
||||
|
||||
static struct slap_daemon {
|
||||
ldap_pvt_thread_mutex_t sd_mutex;
|
||||
@ -1951,6 +1952,7 @@ slapd_daemon_task(
|
||||
slap_listeners = NULL;
|
||||
|
||||
if( !slapd_gentle_shutdown ) {
|
||||
slapd_abrupt_shutdown = 1;
|
||||
connections_shutdown();
|
||||
}
|
||||
|
||||
|
@ -382,6 +382,8 @@ LDAP_SLAPD_F (void) slapd_clr_write LDAP_P((ber_socket_t s, int wake));
|
||||
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;
|
||||
|
||||
/*
|
||||
* dn.c
|
||||
*/
|
||||
|
@ -209,6 +209,9 @@ do_syncrepl(
|
||||
const char *text;
|
||||
int match;
|
||||
|
||||
struct timeval *tout_p = NULL;
|
||||
struct timeval tout = { 10, 0 };
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( OPERATION, DETAIL1, "do_syncrepl\n", 0, 0, 0 );
|
||||
#else
|
||||
@ -444,7 +447,21 @@ do_syncrepl(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (( rc = ldap_result( ld, LDAP_RES_ANY, LDAP_MSG_ONE, NULL, &res )) > 0 ) {
|
||||
if ( abs(si->type) == LDAP_SYNC_REFRESH_AND_PERSIST ){
|
||||
tout_p = &tout;
|
||||
} else {
|
||||
tout_p = NULL;
|
||||
}
|
||||
|
||||
while (( rc = ldap_result( ld, LDAP_RES_ANY, LDAP_MSG_ONE, tout_p, &res )) >= 0 ) {
|
||||
|
||||
if ( rc == 0 ) {
|
||||
if ( slapd_abrupt_shutdown ) {
|
||||
break;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for ( msg = ldap_first_message( ld, res );
|
||||
msg != NULL;
|
||||
@ -630,6 +647,7 @@ done:
|
||||
|
||||
if ( res )
|
||||
ldap_msgfree( res );
|
||||
|
||||
ldap_unbind( ld );
|
||||
|
||||
ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
|
||||
|
Loading…
Reference in New Issue
Block a user