From 0965781b5a02ff9bd05feaef2f5cfbc375ea2174 Mon Sep 17 00:00:00 2001
From: Howard Chu <hyc@openldap.org>
Date: Tue, 12 Feb 2008 18:50:14 +0000
Subject: [PATCH] Sync with HEAD

---
 servers/slapd/syncrepl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c
index e5f732f446..1b008233b7 100644
--- a/servers/slapd/syncrepl.c
+++ b/servers/slapd/syncrepl.c
@@ -1158,7 +1158,9 @@ do_syncrepl(
 	if ( si == NULL )
 		return NULL;
 
-	ldap_pvt_thread_mutex_lock( &si->si_mutex );
+	/* Don't wait around if there's a previous session still running */
+	if ( ldap_pvt_thread_mutex_trylock( &si->si_mutex ))
+		return NULL;
 
 	switch( abs( si->si_type ) ) {
 	case LDAP_SYNC_REFRESH_ONLY:
-- 
GitLab