]> git.sur5r.net Git - openldap/commitdiff
More for ITS#6011
authorHoward Chu <hyc@openldap.org>
Tue, 17 Mar 2009 00:56:23 +0000 (00:56 +0000)
committerHoward Chu <hyc@openldap.org>
Tue, 17 Mar 2009 00:56:23 +0000 (00:56 +0000)
servers/slapd/syncrepl.c

index 145ea24b56261704949e99239db68d7b1a7a4447..73a56a3ccff2a5a8d6ccd49d089472a24fc43657 100644 (file)
@@ -1258,11 +1258,11 @@ do_syncrepl(
        int i, defer = 1, fail = 0;
        Backend *be;
 
-       Debug( LDAP_DEBUG_TRACE, "=>do_syncrepl %s\n", si->si_ridtxt, 0, 0 );
-
        if ( si == NULL )
                return NULL;
 
+       Debug( LDAP_DEBUG_TRACE, "=>do_syncrepl %s\n", si->si_ridtxt, 0, 0 );
+
        /* Don't get stuck here while a pause is initiated */
        while ( ldap_pvt_thread_mutex_trylock( &si->si_mutex )) {
                if ( slapd_shutdown )
@@ -4597,11 +4597,15 @@ syncrepl_config( ConfigArgs *c )
                                         * happen when running on the cn=config DB.
                                         */
                                        if ( si->si_re ) {
-                                               if ( ldap_pvt_thread_mutex_trylock( &si->si_mutex )) {
+                                               Connection *c;
+                                               if ( ldap_pvt_thread_mutex_trylock( &si->si_mutex ))
                                                        isrunning = 1;
-                                               } else {
+                                               c = si->si_conn;
+                                               si->si_conn = NULL;
+                                               if ( c )
+                                                       connection_client_stop( c );
+                                               if ( !isrunning )
                                                        ldap_pvt_thread_mutex_unlock( &si->si_mutex );
-                                               }
                                        }
                                        if ( si->si_re && isrunning ) {
                                                si->si_ctype = 0;