From 28abe9d98cbb3fffba6e861e3d2f91a6a24b915a Mon Sep 17 00:00:00 2001
From: Quanah Gibson-Mount <quanah@openldap.org>
Date: Mon, 6 Oct 2008 19:49:55 +0000
Subject: [PATCH] ITS#5725,ITS#5726,ITS#5719

---
 CHANGES                    |  3 +++
 servers/slapd/connection.c |  1 -
 servers/slapd/syncrepl.c   | 11 +++--------
 3 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/CHANGES b/CHANGES
index 808016bb39..f06bde02cf 100644
--- a/CHANGES
+++ b/CHANGES
@@ -14,16 +14,19 @@ OpenLDAP 2.4.12 Engineering
 	Fixed slapd dynacl mask handling (ITS#5637)
 	Fixed slapd firstComponentMatch normalization (ITS#5634)
 	Added slapd caseIgnoreListMatch (ITS#5608)
+	Fixed slapd connection events enabled twice (ITS#5725)
 	Fixed slapd memory handling (ITS#5691)
 	Fixed slapd objectClass canonicalization (ITS#5681)
 	Fixed slapd objectClass termination (ITS#5682)
 	Fixed slapd overlay control registration (ITS#5649)
+	Fixed slapd runqueue checking (ITS#5726)
 	Fixed slapd spurious text output (ITS#5688)
 	Fixed slapd socket closing on Windows (ITS#5606)
 	Fixed slapd sortvals comparison (ITS#5578)
 	Added slapd substitute syntax support (ITS#5663)
 	Fixed slapd syncrepl contextCSN detection (ITS#5675)
 	Fixed slapd syncrepl error logging (ITS#5618)
+	Fixed slapd syncrepl runqueue interval (ITS#5719)
 	Fixed slapd-bdb entry return if attr not present (ITS#5650)
 	Fixed slapd-bdb olcDbMode syntax (ITS#5713)
 	Fixed slapd-dnssrv memory handling (ITS#5691)
diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c
index c4b858dc3b..ce36494b52 100644
--- a/servers/slapd/connection.c
+++ b/servers/slapd/connection.c
@@ -1150,7 +1150,6 @@ Connection *connection_client_setup(
 		c->c_clientarg = arg;
 
 		slapd_add_internal( sfd, 0 );
-		slapd_set_read( sfd, 1 );
 	}
 	return c;
 }
diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c
index a921453294..128f302956 100644
--- a/servers/slapd/syncrepl.c
+++ b/servers/slapd/syncrepl.c
@@ -1204,7 +1204,7 @@ do_syncrepl(
 	OperationBuffer opbuf;
 	Operation *op;
 	int rc = LDAP_SUCCESS;
-	int dostop = 0, do_setup = 0;
+	int dostop = 0;
 	ber_socket_t s;
 	int i, defer = 1, fail = 0;
 	Backend *be;
@@ -1319,9 +1319,8 @@ reload:
 				if ( rc == LDAP_SUCCESS ) {
 					if ( si->si_conn ) {
 						connection_client_enable( si->si_conn );
-						goto success;
 					} else {
-						do_setup = 1;
+						si->si_conn = connection_client_setup( s, do_syncrepl, arg );
 					} 
 				} else if ( si->si_conn ) {
 					dostop = 1;
@@ -1353,6 +1352,7 @@ reload:
 	if ( rc == SYNC_PAUSED ) {
 		rtask->interval.tv_sec = 0;
 		ldap_pvt_runqueue_resched( &slapd_rq, rtask, 0 );
+		rtask->interval.tv_sec = si->si_interval;
 		rc = 0;
 	} else if ( rc == LDAP_SUCCESS ) {
 		if ( si->si_type == LDAP_SYNC_REFRESH_ONLY ) {
@@ -1387,11 +1387,6 @@ reload:
 	}
 
 	ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
-
-	if ( do_setup )
-		si->si_conn = connection_client_setup( s, do_syncrepl, arg );
-
-success:
 	ldap_pvt_thread_mutex_unlock( &si->si_mutex );
 
 	if ( rc ) {
-- 
GitLab