From f7a6c4360c449d6a59531391ef3d345af891a20d Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Thu, 16 Aug 2007 10:05:21 +0000 Subject: [PATCH] defer thread key retrieve as it might not be needed --- servers/slapd/back-meta/bind.c | 11 +++++++++-- servers/slapd/back-meta/search.c | 3 ++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/servers/slapd/back-meta/bind.c b/servers/slapd/back-meta/bind.c index 252e726441..c1c02496e8 100644 --- a/servers/slapd/back-meta/bind.c +++ b/servers/slapd/back-meta/bind.c @@ -64,7 +64,7 @@ meta_back_bind( Operation *op, SlapReply *rs ) gotit = 0, isroot = 0; - SlapReply *candidates = meta_back_candidates_get( op ); + SlapReply *candidates; rs->sr_err = LDAP_SUCCESS; @@ -122,6 +122,8 @@ meta_back_bind( Operation *op, SlapReply *rs ) return rs->sr_err; } + candidates = meta_back_candidates_get( op ); + /* * Each target is scanned ... */ @@ -324,6 +326,9 @@ meta_back_bind_op_result( ">>> %s meta_back_bind_op_result[%d]\n", op->o_log_prefix, candidate, 0 ); + /* make sure this is clean */ + assert( rs->sr_ctrls == NULL ); + if ( rs->sr_err == LDAP_SUCCESS ) { time_t stoptime = (time_t)(-1), timeout; @@ -634,7 +639,7 @@ meta_back_dobind( i, isroot = 0; - SlapReply *candidates = meta_back_candidates_get( op ); + SlapReply *candidates; if ( be_isroot( op ) ) { isroot = 1; @@ -654,6 +659,8 @@ meta_back_dobind( goto done; } + candidates = meta_back_candidates_get( op ); + for ( i = 0; i < mi->mi_ntargets; i++ ) { metatarget_t *mt = mi->mi_targets[ i ]; metasingleconn_t *msc = &mc->mc_conns[ i ]; diff --git a/servers/slapd/back-meta/search.c b/servers/slapd/back-meta/search.c index dc59751975..713a876761 100644 --- a/servers/slapd/back-meta/search.c +++ b/servers/slapd/back-meta/search.c @@ -680,7 +680,7 @@ meta_back_search( Operation *op, SlapReply *rs ) dncookie dc; int is_ok = 0; void *savepriv; - SlapReply *candidates = meta_back_candidates_get( op ); + SlapReply *candidates = NULL; /* * controls are set in ldap_back_dobind() @@ -697,6 +697,7 @@ getconn:; dc.conn = op->o_conn; dc.rs = rs; + if ( candidates == NULL ) candidates = meta_back_candidates_get( op ); /* * Inits searches */ -- 2.39.5