]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Import ITS#3546 fix from HEAD
authorHoward Chu <hyc@openldap.org>
Thu, 17 Feb 2005 16:24:56 +0000 (16:24 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 17 Feb 2005 16:24:56 +0000 (16:24 +0000)
servers/slapd/config.c
servers/slapd/slap.h
servers/slapd/syncrepl.c

index f80beb77570bfebc1d6724af68da9ecc7461683f..cf9e90eb69581d643425bec59892330701445fa4 100644 (file)
@@ -2975,6 +2975,7 @@ add_syncrepl(
 
        si->si_presentlist = NULL;
        LDAP_LIST_INIT( &si->si_nonpresentlist );
+       ldap_pvt_thread_mutex_init( &si->si_mutex );
 
        rc = parse_syncrepl_line( cargv, cargc, si );
 
index 14c4d6f26a71c40b793f81fbeb3c9e7105e44e68..9136f84122fa7aa4cf6737d009d83d5c5fc497b6 100644 (file)
@@ -1411,6 +1411,7 @@ typedef struct syncinfo_s {
                LDAP                            *si_ld;
                LDAP_LIST_HEAD(np, nonpresent_entry) si_nonpresentlist;
                LDAP_STAILQ_ENTRY( syncinfo_s ) si_next;
+               ldap_pvt_thread_mutex_t si_mutex;
 } syncinfo_t;
 
 LDAP_TAILQ_HEAD( be_pcl, slap_csn_entry );
index da4b114741c2cc958a3c45112f7249a42e7a277a..23488bf2cf456c5ec701add02352f83c65be7574 100644 (file)
@@ -543,6 +543,10 @@ do_syncrep2(
                  msg != NULL;
                  msg = ldap_next_message( si->si_ld, msg ) )
                {
+                       if ( slapd_shutdown ) {
+                               rc = -2;
+                               goto done;
+                       }
                        switch( ldap_msgtype( msg ) ) {
                        case LDAP_RES_SEARCH_ENTRY:
                                ldap_get_entry_controls( si->si_ld, msg, &rctrls );
@@ -860,11 +864,14 @@ do_syncrepl(
        if ( si == NULL )
                return NULL;
 
+       ldap_pvt_thread_mutex_lock( &si->si_mutex );
+
        switch( abs( si->si_type )) {
        case LDAP_SYNC_REFRESH_ONLY:
        case LDAP_SYNC_REFRESH_AND_PERSIST:
                break;
        default:
+               ldap_pvt_thread_mutex_unlock( &si->si_mutex );
                return NULL;
        }
 
@@ -875,6 +882,7 @@ do_syncrepl(
                        ldap_unbind( si->si_ld );
                        si->si_ld = NULL;
                }
+               ldap_pvt_thread_mutex_unlock( &si->si_mutex );
                return NULL;
        }
 
@@ -976,6 +984,7 @@ do_syncrepl(
        }
        
        ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+       ldap_pvt_thread_mutex_unlock( &si->si_mutex );
 
        return NULL;
 }
@@ -2356,6 +2365,7 @@ avl_ber_bvfree( void *bv )
 void
 syncinfo_free( syncinfo_t *sie )
 {
+       ldap_pvt_thread_mutex_destroy( &sie->si_mutex );
        if ( sie->si_provideruri ) {
                ch_free( sie->si_provideruri );
        }