]> git.sur5r.net Git - openldap/commitdiff
Fix cancel cleanup
authorHoward Chu <hyc@openldap.org>
Fri, 18 Feb 2005 07:12:57 +0000 (07:12 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 18 Feb 2005 07:12:57 +0000 (07:12 +0000)
servers/slapd/overlays/syncprov.c

index 20e5379a0e21d0f5d58bd35572cec93d7e0a2a8a..84b6523d6f588a898e032e9abf79f938cc5534a4 100644 (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 );