]> git.sur5r.net Git - openldap/commitdiff
ITS#5376 must abandon current session before starting new refresh
authorHoward Chu <hyc@openldap.org>
Wed, 13 Feb 2008 07:37:29 +0000 (07:37 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 13 Feb 2008 07:37:29 +0000 (07:37 +0000)
servers/slapd/syncrepl.c

index 65b86479bec84c02dc41c4f0e63b23279c52eb24..71c88250ca0c8f514cf95fe0458c6baad8e11ddc 100644 (file)
@@ -96,6 +96,7 @@ typedef struct syncinfo_s {
        int                     si_refreshDone;
        int                     si_syncdata;
        int                     si_logstate;
+       ber_int_t       si_msgid;
        Avlnode                 *si_presentlist;
        LDAP                    *si_ld;
        Connection              *si_conn;
@@ -342,7 +343,6 @@ ldap_sync_search(
        BerElementBuffer berbuf;
        BerElement *ber = (BerElement *)&berbuf;
        LDAPControl c[2], *ctrls[3];
-       ber_int_t       msgid;
        int rc;
        int rhint;
        char *base;
@@ -427,7 +427,7 @@ ldap_sync_search(
        }
 
        rc = ldap_search_ext( si->si_ld, base, scope, filter, attrs, attrsonly,
-               ctrls, NULL, NULL, si->si_slimit, &msgid );
+               ctrls, NULL, NULL, si->si_slimit, &si->si_msgid );
        ber_free_buf( ber );
        return rc;
 }
@@ -743,7 +743,7 @@ do_syncrep2(
                tout_p = NULL;
        }
 
-       while ( ( rc = ldap_result( si->si_ld, LDAP_RES_ANY, LDAP_MSG_ONE,
+       while ( ( rc = ldap_result( si->si_ld, si->si_msgid, LDAP_MSG_ONE,
                tout_p, &res ) ) > 0 )
        {
                if ( slapd_shutdown ) {
@@ -836,6 +836,7 @@ do_syncrep2(
                                        } else if ( rc == LDAP_NO_SUCH_OBJECT ) {
                                                rc = LDAP_SYNC_REFRESH_REQUIRED;
                                                si->si_logstate = SYNCLOG_FALLBACK;
+                                               ldap_abandon_ext( si->si_ld, si->si_msgid, NULL, NULL );
                                        }
                                } else if ( ( rc = syncrepl_message_to_entry( si, op, msg,
                                        &modlist, &entry, syncstate ) ) == LDAP_SUCCESS )