From eda6c5abcb119709c25e78b1d113436408ccda51 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Fri, 22 Apr 2005 12:59:30 +0000 Subject: [PATCH] remove unnecessary call --- servers/slapd/back-meta/add.c | 6 +----- servers/slapd/back-meta/back-meta.h | 5 ----- servers/slapd/back-meta/bind.c | 25 ------------------------- servers/slapd/back-meta/conn.c | 15 ++++++++++----- servers/slapd/back-meta/delete.c | 6 +----- servers/slapd/back-meta/modify.c | 8 ++------ servers/slapd/back-meta/modrdn.c | 8 ++------ 7 files changed, 16 insertions(+), 57 deletions(-) diff --git a/servers/slapd/back-meta/add.c b/servers/slapd/back-meta/add.c index eec76d28af..922a519eaf 100644 --- a/servers/slapd/back-meta/add.c +++ b/servers/slapd/back-meta/add.c @@ -56,11 +56,7 @@ meta_back_add( Operation *op, SlapReply *rs ) 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 diff --git a/servers/slapd/back-meta/back-meta.h b/servers/slapd/back-meta/back-meta.h index 3117cc4805..73dd4b5af5 100644 --- a/servers/slapd/back-meta/back-meta.h +++ b/servers/slapd/back-meta/back-meta.h @@ -264,11 +264,6 @@ meta_back_single_dobind( 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, diff --git a/servers/slapd/back-meta/bind.c b/servers/slapd/back-meta/bind.c index b18bde5d70..9cbc4edcca 100644 --- a/servers/slapd/back-meta/bind.c +++ b/servers/slapd/back-meta/bind.c @@ -423,31 +423,6 @@ done:; 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 * diff --git a/servers/slapd/back-meta/conn.c b/servers/slapd/back-meta/conn.c index 650ab4b558..f659dfa597 100644 --- a/servers/slapd/back-meta/conn.c +++ b/servers/slapd/back-meta/conn.c @@ -847,14 +847,19 @@ done:; 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 ); diff --git a/servers/slapd/back-meta/delete.c b/servers/slapd/back-meta/delete.c index 3ee7ac8d5d..1bc7b72425 100644 --- a/servers/slapd/back-meta/delete.c +++ b/servers/slapd/back-meta/delete.c @@ -46,11 +46,7 @@ meta_back_delete( Operation *op, SlapReply *rs ) 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 diff --git a/servers/slapd/back-meta/modify.c b/servers/slapd/back-meta/modify.c index 12c1d7107f..01b86a2b44 100644 --- a/servers/slapd/back-meta/modify.c +++ b/servers/slapd/back-meta/modify.c @@ -51,12 +51,8 @@ meta_back_modify( Operation *op, SlapReply *rs ) 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 diff --git a/servers/slapd/back-meta/modrdn.c b/servers/slapd/back-meta/modrdn.c index 6276d19523..ea0d94160b 100644 --- a/servers/slapd/back-meta/modrdn.c +++ b/servers/slapd/back-meta/modrdn.c @@ -52,13 +52,9 @@ meta_back_modrdn( Operation *op, SlapReply *rs ) 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; -- 2.39.5