From: Howard Chu Date: Fri, 18 Feb 2005 07:12:57 +0000 (+0000) Subject: Fix cancel cleanup X-Git-Tag: OPENLDAP_REL_ENG_2_3_BP~162 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=94b3f430cf5e52196a61a7216cfaa84f7efedd4e;p=openldap Fix cancel cleanup --- diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index 20e5379a0e..84b6523d6f 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -860,6 +860,16 @@ syncprov_drop_psearch( syncops *so, int lock ) return 0; } +static int +syncprov_ab_cleanup( Operation *op, SlapReply *rs ) +{ + slap_callback *sc = op->o_callback; + op->o_callback = sc->sc_next; + syncprov_drop_psearch( op->o_callback->sc_private, 0 ); + op->o_tmpfree( sc, op->o_tmpmemctx ); + return 0; +} + static int syncprov_op_abandon( Operation *op, SlapReply *rs ) { @@ -884,8 +894,13 @@ syncprov_op_abandon( Operation *op, SlapReply *rs ) so->s_op->o_cancel = SLAP_CANCEL_ACK; rs->sr_err = LDAP_CANCELLED; send_ldap_result( so->s_op, rs ); - while ( so->s_op->o_cancel != SLAP_CANCEL_DONE ) { - ldap_pvt_thread_yield(); + if ( so->s_flags & PS_IS_DETACHED ) { + slap_callback *cb; + cb = op->o_tmpcalloc( 1, sizeof(slap_callback), op->o_tmpmemctx ); + cb->sc_cleanup = syncprov_ab_cleanup; + cb->sc_next = op->o_callback; + cb->sc_private = so; + return SLAP_CB_CONTINUE; } } syncprov_drop_psearch( so, 0 );