entry->next_sched.tv_usec = 0;
entry->routine = routine;
entry->arg = arg;
- LDAP_STAILQ_INSERT_HEAD( &rq->task_list, entry, tnext );
+ LDAP_STAILQ_INSERT_TAIL( &rq->task_list, entry, tnext );
}
void
struct re_s* entry
)
{
- LDAP_STAILQ_INSERT_HEAD( &rq->run_list, entry, rnext );
+ LDAP_STAILQ_INSERT_TAIL( &rq->run_list, entry, rnext );
}
void
} else {
LDAP_STAILQ_INSERT_AFTER( &rq->task_list, prev, entry, tnext );
}
- break;
+ return;
} else if ( e->next_sched.tv_sec > entry->next_sched.tv_sec ) {
if ( prev == NULL ) {
LDAP_STAILQ_INSERT_HEAD( &rq->task_list, entry, tnext );
} else {
LDAP_STAILQ_INSERT_AFTER( &rq->task_list, prev, entry, tnext );
}
- break;
+ return;
}
prev = e;
}
+ LDAP_STAILQ_INSERT_TAIL( &rq->task_list, entry, tnext );
}
}
op->o_sync_state.sid = -1;
op->o_sync_slog_size = -1;
+ op->o_sync_state.rid = -1;
ldap_pvt_thread_mutex_lock( &slap_op_mutex );
LDAP_STAILQ_INSERT_HEAD( &slap_free_ops, op, o_next );
ldap_pvt_thread_mutex_unlock( &slap_op_mutex );
op->o_sync_state.sid = -1;
op->o_sync_slog_size = -1;
+ op->o_sync_state.rid = -1;
LDAP_STAILQ_FIRST( &op->o_sync_slog_list ) = NULL;
op->o_sync_slog_list.stqh_last = &LDAP_STAILQ_FIRST( &op->o_sync_slog_list );
struct berval syncrepl_cn_bv;
struct sync_cookie *sc = NULL;
struct sync_cookie syncCookie = { NULL, -1, NULL };
+ struct berval *psub;
+
+ psub = &si->si_be->be_nsuffix[0];
/* Init connection to master */
syncrepl_cn_bv.bv_val = syncrepl_cbuf;
syncrepl_cn_bv.bv_len = snprintf(syncrepl_cbuf, sizeof(syncrepl_cbuf),
CN_STR "syncrepl%d", si->si_id );
- build_new_dn( &op->o_req_ndn, &si->si_base, &syncrepl_cn_bv,
- op->o_tmpmemctx );
+ build_new_dn( &op->o_req_ndn, psub, &syncrepl_cn_bv, op->o_tmpmemctx );
op->o_req_dn = op->o_req_ndn;
LDAP_STAILQ_FOREACH( sc, &slap_sync_cookie, sc_next ) {
sc = NULL;
} else {
/* stored cookie */
+ struct berval newcookie = { 0, NULL };
ber_dupbv( &cookie_bv, &cookie[0] );
ber_bvarray_add( &si->si_syncCookie.octet_str, &cookie_bv );
slap_parse_sync_cookie( &si->si_syncCookie );
+ ber_bvarray_free( si->si_syncCookie.octet_str );
+ si->si_syncCookie.octet_str = NULL;
ber_bvarray_free_x( cookie, op->o_tmpmemctx );
if ( sc->sid != -1 ) {
/* command line cookie wins */
}
slap_sync_cookie_free( sc, 1 );
sc = NULL;
+ slap_compose_sync_cookie( NULL, &newcookie,
+ &si->si_syncCookie.ctxcsn[0],
+ si->si_syncCookie.sid, si->si_syncCookie.rid );
+ ber_bvarray_add( &si->si_syncCookie.octet_str, &newcookie );
}
} else {
/* no command line cookie is specified */