From: Howard Chu Date: Tue, 7 Dec 2004 10:43:48 +0000 (+0000) Subject: Rearrange shortcut check for context with no changes X-Git-Tag: OPENLDAP_REL_ENG_2_3_0ALPHA~105 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4ae3efbdd7640ebbe0b09316371bc6dc2e4f4eee;p=openldap Rearrange shortcut check for context with no changes --- diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index 60f476d26b..61f94b9662 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -1510,6 +1510,24 @@ syncprov_op_search( Operation *op, SlapReply *rs ) send_ldap_error( op, rs, LDAP_OTHER, "invalid sync cookie" ); return rs->sr_err; } + /* If just Refreshing and nothing has changed, shortcut it */ + if ( bvmatch( srs->sr_state.ctxcsn, &si->si_ctxcsn )) { + nochange = 1; + if ( !(op->o_sync_mode & SLAP_SYNC_PERSIST) ) { + LDAPControl *ctrls[2]; + + ctrls[0] = NULL; + ctrls[1] = NULL; + syncprov_done_ctrl( op, rs, ctrls, 0, 0, + NULL, LDAP_SYNC_REFRESH_DELETES ); + rs->sr_ctrls = ctrls; + rs->sr_err = LDAP_SUCCESS; + send_ldap_result( op, rs ); + rs->sr_ctrls = NULL; + return rs->sr_err; + } + goto shortcut; + } /* Is the CSN still present in the database? */ if ( syncprov_findcsn( op, FIND_CSN ) != LDAP_SUCCESS ) { /* No, so a reload is required */ @@ -1521,24 +1539,6 @@ syncprov_op_search( Operation *op, SlapReply *rs ) #endif } else { gotstate = 1; - /* If just Refreshing and nothing has changed, shortcut it */ - if ( bvmatch( srs->sr_state.ctxcsn, &si->si_ctxcsn )) { - nochange = 1; - if ( !(op->o_sync_mode & SLAP_SYNC_PERSIST) ) { - LDAPControl *ctrls[2]; - - ctrls[0] = NULL; - ctrls[1] = NULL; - syncprov_done_ctrl( op, rs, ctrls, 0, 0, - NULL, LDAP_SYNC_REFRESH_DELETES ); - rs->sr_ctrls = ctrls; - rs->sr_err = LDAP_SUCCESS; - send_ldap_result( op, rs ); - rs->sr_ctrls = NULL; - return rs->sr_err; - } - goto shortcut; - } else /* If context has changed, check for Present UUIDs */ if ( syncprov_findcsn( op, FIND_PRESENT ) != LDAP_SUCCESS ) { send_ldap_result( op, rs );