Fix cancel cleanup

This commit is contained in:
Howard Chu 2005-02-18 07:12:57 +00:00
parent 6cbe778c81
commit 94b3f430cf

View File

@ -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 );