]> git.sur5r.net Git - openldap/commitdiff
remove unnecessary call
authorPierangelo Masarati <ando@openldap.org>
Fri, 22 Apr 2005 12:59:30 +0000 (12:59 +0000)
committerPierangelo Masarati <ando@openldap.org>
Fri, 22 Apr 2005 12:59:30 +0000 (12:59 +0000)
servers/slapd/back-meta/add.c
servers/slapd/back-meta/back-meta.h
servers/slapd/back-meta/bind.c
servers/slapd/back-meta/conn.c
servers/slapd/back-meta/delete.c
servers/slapd/back-meta/modify.c
servers/slapd/back-meta/modrdn.c

index eec76d28afa230ceef2136c57ef2a18a7ab70aea..922a519eafa80f63ab06d7264a3b408ac37c840d 100644 (file)
@@ -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
index 3117cc48056037c8e2ef07ff12208dcb47b2032c..73dd4b5af51f302339d4089772a6d139cb50a64a 100644 (file)
@@ -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,
index b18bde5d70273e24dcc08dc1049a21c59aea2df7..9cbc4edcca22f747fbacb64f88fa5ac1c9ecc4db 100644 (file)
@@ -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
  *
index 650ab4b558bf7520cbd725c142c34e9f026dca9b..f659dfa5971595ab78137899be264f7dab1c075f 100644 (file)
@@ -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 );
index 3ee7ac8d5d2ac84526688a943a8f4f9eaf1bd185..1bc7b72425abccc184c5b070a0bafb3207592711 100644 (file)
@@ -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
index 12c1d7107f991ff38e10f42949c06952fd51ac28..01b86a2b44abcb14ca52442e08472f9f0ad2f42e 100644 (file)
@@ -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
index 6276d19523cf2f0de735804e397249cc80abcb11..ea0d94160b28fa435f66c2df0c1bf6141dc03340 100644 (file)
@@ -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;