From 423c53d26798a0682925dd41de6b03b9c4c7c69b Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 9 Dec 2004 21:17:29 +0000 Subject: [PATCH] Add fe_op_abandon, call it in connection_abandon() --- servers/slapd/abandon.c | 24 ++++++++++++++---------- servers/slapd/connection.c | 9 +++++++-- servers/slapd/frontend.c | 1 + servers/slapd/proto-slap.h | 2 -- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/servers/slapd/abandon.c b/servers/slapd/abandon.c index 670e540f4e..a3c1eb63c1 100644 --- a/servers/slapd/abandon.c +++ b/servers/slapd/abandon.c @@ -93,20 +93,24 @@ do_abandon( Operation *op, SlapReply *rs ) done: op->orn_msgid = id; - if ( frontendDB->be_abandon ) { - op->o_bd = frontendDB; - frontendDB->be_abandon( op, rs ); - } - - for ( i = 0; i < nbackends; i++ ) { - op->o_bd = &backends[i]; - if( op->o_bd->be_abandon ) op->o_bd->be_abandon( op, rs ); - } + op->o_bd = frontendDB; + rs->sr_err = frontendDB->be_abandon( op, rs ); ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex ); Debug( LDAP_DEBUG_TRACE, "do_abandon: op=%ld %sfound\n", (long) id, o ? "" : "not ", 0 ); - return LDAP_SUCCESS; + return rs->sr_err; } +int +fe_op_abandon( Operation *op, SlapReply *rs ) +{ + int i; + + for ( i = 0; i < nbackends; i++ ) { + op->o_bd = &backends[i]; + if( op->o_bd->be_abandon ) op->o_bd->be_abandon( op, rs ); + } + return LDAP_SUCCESS; +} diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index 43987952e8..b3d4b2e2bf 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -710,10 +710,15 @@ static void connection_abandon( Connection *c ) { /* c_mutex must be locked by caller */ - Operation *o; + Operation *o, *next, op = {0}; + SlapReply rs = {0}; - LDAP_STAILQ_FOREACH(o, &c->c_ops, o_next) { + op.o_tag = LDAP_REQ_ABANDON; + for ( o = LDAP_STAILQ_FIRST( &c->c_ops ); o; o=next ) { + next = LDAP_STAILQ_NEXT( o, o_next ); + op.orn_msgid = o->o_msgid; o->o_abandon = 1; + frontendDB->be_abandon( &op, &rs ); } /* remove pending operations */ diff --git a/servers/slapd/frontend.c b/servers/slapd/frontend.c index 0aedfc0e84..c3638dbd2e 100644 --- a/servers/slapd/frontend.c +++ b/servers/slapd/frontend.c @@ -83,6 +83,7 @@ frontend_init( void ) frontendDB->bd_info->bi_controls = slap_known_controls; /* calls */ + frontendDB->bd_info->bi_op_abandon = fe_op_abandon; frontendDB->bd_info->bi_op_add = fe_op_add; frontendDB->bd_info->bi_op_bind = fe_op_bind; frontendDB->bd_info->bi_op_compare = fe_op_compare; diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 31b64e6ce9..73cb30fe40 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -1410,9 +1410,7 @@ LDAP_SLAPD_F (int) do_extended LDAP_P((Operation *op, SlapReply *rs)); /* * frontend operations */ -#if 0 LDAP_SLAPD_F (int) fe_op_abandon LDAP_P((Operation *op, SlapReply *rs)); -#endif LDAP_SLAPD_F (int) fe_op_add LDAP_P((Operation *op, SlapReply *rs)); LDAP_SLAPD_F (int) fe_op_bind LDAP_P((Operation *op, SlapReply *rs)); LDAP_SLAPD_F (int) fe_op_compare LDAP_P((Operation *op, SlapReply *rs)); -- 2.39.5