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;
slap_listeners = NULL;
if( !slapd_gentle_shutdown ) {
+ slapd_abrupt_shutdown = 1;
connections_shutdown();
}
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
*/
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
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;
if ( res )
ldap_msgfree( res );
+
ldap_unbind( ld );
ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );