return rs->sr_err;
}
- if ( !meta_back_is_valid( mc, candidate ) ) {
- rs->sr_err = LDAP_UNAVAILABLE;
- send_ldap_result( op, rs );
- return rs->sr_err;
- }
+ assert( mc->mc_conns[ candidate ].msc_ld != NULL );
/*
* Rewrite the add dn, if needed
ldap_back_send_t sendok,
int retries );
-extern int
-meta_back_is_valid(
- struct metaconn *lc,
- int candidate );
-
extern int
meta_back_op_result(
struct metaconn *lc,
return( bound > 0 );
}
-/*
- *
- */
-int
-meta_back_is_valid( struct metaconn *mc, int candidate )
-{
- struct metasingleconn *msc;
- int i;
-
- assert( mc );
-
- if ( candidate < 0 ) {
- return 0;
- }
-
- for ( i = 0, msc = &mc->mc_conns[ 0 ]; !META_LAST( msc ) && i < candidate;
- ++i, ++msc );
-
- if ( !META_LAST( msc ) ) {
- return ( msc->msc_ld != NULL );
- }
-
- return 0;
-}
-
/*
* meta_back_rebind
*
ldap_pvt_thread_mutex_unlock( &mi->mi_conn_mutex );
- Debug( LDAP_DEBUG_TRACE,
- "=>meta_back_getconn: conn %ld inserted\n",
- mc->mc_conn->c_connid, 0, 0 );
-
/*
* Err could be -1 in case a duplicate metaconn is inserted
*/
- if ( err != 0 ) {
+ if ( err == 0 ) {
+ Debug( LDAP_DEBUG_TRACE,
+ "%s meta_back_getconn: conn %ld inserted\n",
+ op->o_log_prefix, mc->mc_conn->c_connid, 0 );
+
+ } else {
+ Debug( LDAP_DEBUG_TRACE,
+ "%s meta_back_getconn: conn %ld insert failed\n",
+ op->o_log_prefix, mc->mc_conn->c_connid, 0 );
+
rs->sr_err = LDAP_OTHER;
rs->sr_text = "Internal server error";
meta_back_conn_free( mc );
return rs->sr_err;
}
- if ( !meta_back_is_valid( lc, candidate ) ) {
- rs->sr_err = LDAP_OTHER;
- send_ldap_result( op, rs );
- return rs->sr_err;
- }
+ assert( lc->mc_conns[ candidate ].msc_ld != NULL );
/*
* Rewrite the compare dn, if needed
if ( !lc || !meta_back_dobind( lc, op, LDAP_BACK_SENDERR ) ) {
return rs->sr_err;
}
-
- if ( !meta_back_is_valid( lc, candidate ) ) {
- rs->sr_err = LDAP_OTHER;
- send_ldap_result( op, rs );
- return rs->sr_err;
- }
+
+ assert( lc->mc_conns[ candidate ].msc_ld != NULL );
/*
* Rewrite the modify dn, if needed
if ( !meta_back_dobind( lc, op, LDAP_BACK_SENDERR ) ) {
return rs->sr_err;
}
-
- if ( !meta_back_is_valid( lc, candidate ) ) {
- rs->sr_err = LDAP_OTHER;
- send_ldap_result( op, rs );
- return rs->sr_err;
- }
+ assert( lc->mc_conns[ candidate ].msc_ld != NULL );
+
dc.conn = op->o_conn;
dc.rs = rs;