matched = NULL;
} else {
- if ( !LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
- syncinfo_t *si;
- LDAP_STAILQ_FOREACH( si, &op->o_bd->be_syncinfo, si_next ) {
+ if ( op->o_bd->be_syncinfo ) {
+ syncinfo_t *si = op->o_bd->be_syncinfo;
+ {
struct berval tmpbv;
ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] );
ber_bvarray_add( &deref, &tmpbv );
e = NULL;
} else {
- if ( !LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
- syncinfo_t *si;
- LDAP_STAILQ_FOREACH( si, &op->o_bd->be_syncinfo, si_next ) {
+ if ( op->o_bd->be_syncinfo ) {
+ syncinfo_t *si = op->o_bd->be_syncinfo;
+ {
struct berval tmpbv;
ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] );
ber_bvarray_add( &deref, &tmpbv );
e = NULL;
} else {
- if ( !LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
- syncinfo_t *si;
- LDAP_STAILQ_FOREACH( si, &op->o_bd->be_syncinfo, si_next ) {
+ if ( op->o_bd->be_syncinfo ) {
+ syncinfo_t *si = op->o_bd->be_syncinfo;
+ {
struct berval tmpbv;
ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] );
ber_bvarray_add( &deref, &tmpbv );
cache_return_entry_r( &li->li_cache, matched );
} else {
- if ( !LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
- syncinfo_t *si;
- LDAP_STAILQ_FOREACH( si, &op->o_bd->be_syncinfo, si_next ) {
+ if ( op->o_bd->be_syncinfo ) {
+ syncinfo_t *si = op->o_bd->be_syncinfo;
+ {
struct berval tmpbv;
ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] );
ber_bvarray_add( &deref, &tmpbv );
: NULL;
cache_return_entry_r( &li->li_cache, matched );
} else {
- if ( !LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
- syncinfo_t *si;
- LDAP_STAILQ_FOREACH( si, &op->o_bd->be_syncinfo, si_next ) {
+ if ( op->o_bd->be_syncinfo ) {
+ syncinfo_t *si = op->o_bd->be_syncinfo;
+ {
struct berval tmpbv;
ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] );
ber_bvarray_add( &deref, &tmpbv );
: NULL;
cache_return_entry_r( &li->li_cache, matched );
} else {
- if ( !LDAP_STAILQ_EMPTY( &op->o_bd->be_syncinfo )) {
- syncinfo_t *si;
- LDAP_STAILQ_FOREACH( si, &op->o_bd->be_syncinfo, si_next ) {
+ if ( op->o_bd->be_syncinfo ) {
+ syncinfo_t *si = op->o_bd->be_syncinfo;
+ {
struct berval tmpbv;
ber_dupbv( &tmpbv, &si->si_provideruri_bv[0] );
ber_bvarray_add( &deref, &tmpbv );
if ( rc ) return rc;
- if ( !LDAP_STAILQ_EMPTY( &backendDB[i].be_syncinfo )) {
+ if ( backendDB[i].be_syncinfo ) {
syncinfo_t *si;
if ( !( backendDB[i].be_search && backendDB[i].be_add &&
continue;
}
- LDAP_STAILQ_FOREACH( si, &backendDB[i].be_syncinfo, si_next ) {
+ {
+ si = backendDB[i].be_syncinfo;
si->si_be = &backendDB[i];
init_syncrepl( si );
ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
{
int i;
BackendDB *bd;
- syncinfo_t *si_entry;
struct slap_csn_entry *csne;
ldap_pvt_thread_pool_destroy( &syncrepl_pool, 1 );
/* destroy each backend database */
for( i = 0, bd = backendDB; i < nBackendDB; i++, bd++ ) {
- while ( !LDAP_STAILQ_EMPTY( &bd->be_syncinfo )) {
- si_entry = LDAP_STAILQ_FIRST( &bd->be_syncinfo );
- LDAP_STAILQ_REMOVE_HEAD( &bd->be_syncinfo, si_next );
- syncinfo_free( si_entry );
+ if ( bd->be_syncinfo ) {
+ syncinfo_free( bd->be_syncinfo );
}
if ( bd->be_pending_csn_list ) {
be->be_pcl_mutexp = &be->be_pcl_mutex;
ldap_pvt_thread_mutex_init( be->be_pcl_mutexp );
- LDAP_STAILQ_INIT( &be->be_syncinfo );
-
/* assign a default depth limit for alias deref */
be->be_max_deref_depth = SLAPD_DEFAULT_MAXDEREFDEPTH;
)
{
syncinfo_t *si;
- syncinfo_t *si_entry;
int rc = 0;
- int duplicated_replica_id = 0;
si = (syncinfo_t *) ch_calloc( 1, sizeof( syncinfo_t ) );
rc = parse_syncrepl_line( cargv, cargc, si );
- LDAP_STAILQ_FOREACH( si_entry, &be->be_syncinfo, si_next ) {
- if ( si->si_rid == si_entry->si_rid ) {
- Debug( LDAP_DEBUG_ANY,
- "add_syncrepl: duplicated replica id\n",0, 0, 0 );
- duplicated_replica_id = 1;
- break;
- }
- }
-
- if ( rc < 0 || duplicated_replica_id ) {
+ if ( rc < 0 ) {
Debug( LDAP_DEBUG_ANY, "failed to add syncinfo\n", 0, 0, 0 );
syncinfo_free( si );
return 1;
SLAP_DBFLAGS(be) |= SLAP_DBFLAG_NO_SCHEMA_CHECK;
}
si->si_be = be;
- LDAP_STAILQ_INSERT_TAIL( &be->be_syncinfo, si, si_next );
+ be->be_syncinfo = si;
return 0;
}
}
/* FIXME: do we need this? */
frontendDB->be_pcl_mutexp = &frontendDB->be_pcl_mutex;
ldap_pvt_thread_mutex_init( frontendDB->be_pcl_mutexp );
-
- LDAP_STAILQ_INIT( &frontendDB->be_syncinfo );
#endif
/* suffix */
Avlnode *si_presentlist;
LDAP *si_ld;
LDAP_LIST_HEAD(np, nonpresent_entry) si_nonpresentlist;
- LDAP_STAILQ_ENTRY( syncinfo_s ) si_next;
} syncinfo_t;
LDAP_TAILQ_HEAD( be_pcl, slap_csn_entry );
struct be_pcl *be_pending_csn_list;
ldap_pvt_thread_mutex_t be_pcl_mutex;
ldap_pvt_thread_mutex_t *be_pcl_mutexp;
- LDAP_STAILQ_HEAD( be_si, syncinfo_s ) be_syncinfo; /* For syncrepl */
+ syncinfo_t *be_syncinfo; /* For syncrepl */
char *be_realm;
void *be_pb; /* Netscape plugin */
if ( !si->si_retrynum || si->si_retrynum[i] == -2 ) {
ldap_pvt_runqueue_remove( &slapd_rq, rtask );
- LDAP_STAILQ_REMOVE( &be->be_syncinfo, si, syncinfo_s, si_next );
- syncinfo_free( si );
} else if ( si->si_retrynum[i] >= -1 ) {
if ( si->si_retrynum[i] > 0 )
si->si_retrynum[i]--;