From a1308f8dfad6cc76f259bd35f21d82b7ebbef4bc Mon Sep 17 00:00:00 2001 From: Jong Hyuk Choi Date: Mon, 21 Jun 2004 07:03:49 +0000 Subject: [PATCH] syncrepl retry code fix for correct timing --- libraries/libldap_r/rq.c | 6 +++--- servers/slapd/daemon.c | 5 +++++ servers/slapd/proto-slap.h | 1 + servers/slapd/syncrepl.c | 11 +++++------ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/libraries/libldap_r/rq.c b/libraries/libldap_r/rq.c index 194d16db8e..35df5c7b4a 100644 --- a/libraries/libldap_r/rq.c +++ b/libraries/libldap_r/rq.c @@ -66,9 +66,9 @@ ldap_pvt_runqueue_remove( break; } - if ( e == entry ) { - LDAP_STAILQ_REMOVE( &rq->task_list, entry, re_s, tnext ); - } + assert( e == entry ); + + LDAP_STAILQ_REMOVE( &rq->task_list, entry, re_s, tnext ); LDAP_FREE( entry ); } diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 7e05ee928c..5b8deba052 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -2147,3 +2147,8 @@ void slapd_add_internal(ber_socket_t s, int isactive) { Listener ** slapd_get_listeners(void) { return slap_listeners; } + +void slap_wake_listener() +{ + WAKE_LISTENER(1); +} diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 2c8a865e1f..34a51910fb 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -422,6 +422,7 @@ LDAP_SLAPD_F (void) slapd_remove LDAP_P((ber_socket_t s, int wasactive, int wake LDAP_SLAPD_F (RETSIGTYPE) slap_sig_shutdown LDAP_P((int sig)); LDAP_SLAPD_F (RETSIGTYPE) slap_sig_wake LDAP_P((int sig)); +LDAP_SLAPD_F (void) slap_wake_listener LDAP_P((void)); LDAP_SLAPD_F (void) slapd_set_write LDAP_P((ber_socket_t s, int wake)); LDAP_SLAPD_F (void) slapd_clr_write LDAP_P((ber_socket_t s, int wake)); diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 723bf05f77..bcc4b4f346 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -907,10 +907,11 @@ do_syncrepl( ldap_pvt_runqueue_stoptask( &syncrepl_rq, rtask ); } + if ( dostop ) { + connection_client_stop( s ); + } + if ( rc == LDAP_SUCCESS ) { - if ( dostop ) { - connection_client_stop( s ); - } if ( si->si_type == LDAP_SYNC_REFRESH_ONLY ) { defer = 0; } @@ -929,15 +930,13 @@ do_syncrepl( } if ( !si->si_retrynum || si->si_retrynum[i] == -2 ) { - if ( dostop ) { - connection_client_stop( s ); - } ldap_pvt_runqueue_remove( &syncrepl_rq, rtask ); } else if ( si->si_retrynum[i] >= -1 ) { if ( si->si_retrynum[i] > 0 ) si->si_retrynum[i]--; rtask->interval.tv_sec = si->si_retryinterval[i]; ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, 0 ); + slap_wake_listener(); } } -- 2.39.5