summaryrefslogtreecommitdiff
path: root/source4/libcli/composite
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-05-16 15:02:58 +1000
committerAndrew Tridgell <tridge@samba.org>2008-05-16 15:02:58 +1000
commit14ca2b5b5db4abb1e6ab624365fdebfd9ec422e0 (patch)
tree948297eee7a1bb9747a251c3843d11e8f0b8c081 /source4/libcli/composite
parentde99db1084c73007f1d6f66fe7efb7a1a9271dfc (diff)
downloadsamba-14ca2b5b5db4abb1e6ab624365fdebfd9ec422e0.tar.gz
- added a composite_wait_free() call
- allow composite_error() to take NT_STATUS_OK (This used to be commit 5240e1e25655af1f9b92da99e85d845bf30c4e9e)
Diffstat (limited to 'source4/libcli/composite')
-rw-r--r--source4/libcli/composite/composite.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/source4/libcli/composite/composite.c b/source4/libcli/composite/composite.c
index 966f56cba82..3e3f224f475 100644
--- a/source4/libcli/composite/composite.c
+++ b/source4/libcli/composite/composite.c
@@ -69,6 +69,17 @@ _PUBLIC_ NTSTATUS composite_wait(struct composite_context *c)
return c->status;
}
+/*
+ block until a composite function has completed, then return the status.
+ Free the composite context before returning
+*/
+_PUBLIC_ NTSTATUS composite_wait_free(struct composite_context *c)
+{
+ NTSTATUS status = composite_wait(c);
+ talloc_free(c);
+ return status;
+}
+
/*
callback from composite_done() and composite_error()
@@ -94,6 +105,12 @@ static void composite_trigger(struct event_context *ev, struct timed_event *te,
_PUBLIC_ void composite_error(struct composite_context *ctx, NTSTATUS status)
{
+ /* you are allowed to pass NT_STATUS_OK to composite_error(), in which
+ case it is equivalent to composite_done() */
+ if (NT_STATUS_IS_OK(status)) {
+ composite_done(ctx);
+ return;
+ }
if (!ctx->used_wait && !ctx->async.fn) {
event_add_timed(ctx->event_ctx, ctx, timeval_zero(), composite_trigger, ctx);
}
@@ -187,7 +204,7 @@ _PUBLIC_ void composite_continue_smb2(struct composite_context *ctx,
{
if (composite_nomem(new_req, ctx)) return;
new_req->async.fn = continuation;
- new_req->async.private = private_data;
+ new_req->async.private_data = private_data;
}
_PUBLIC_ void composite_continue_nbt(struct composite_context *ctx,