From 27abf6731ed472580157a0447e858e11f6f63f3b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sat, 3 Jan 2009 10:34:59 +0100 Subject: struct async_req doesn't really need to carry an event_context --- source3/lib/async_req.c | 9 ++++----- source3/lib/async_sock.c | 10 ++++++---- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'source3/lib') diff --git a/source3/lib/async_req.c b/source3/lib/async_req.c index 159666f15c..8c9b2e6b47 100644 --- a/source3/lib/async_req.c +++ b/source3/lib/async_req.c @@ -49,7 +49,7 @@ char *async_req_print(TALLOC_CTX *mem_ctx, struct async_req *req) * The new async request will be initialized in state ASYNC_REQ_IN_PROGRESS */ -struct async_req *async_req_new(TALLOC_CTX *mem_ctx, struct event_context *ev) +struct async_req *async_req_new(TALLOC_CTX *mem_ctx) { struct async_req *result; @@ -58,7 +58,6 @@ struct async_req *async_req_new(TALLOC_CTX *mem_ctx, struct event_context *ev) return NULL; } result->state = ASYNC_REQ_IN_PROGRESS; - result->event_ctx = ev; result->print = async_req_print; return result; } @@ -135,12 +134,12 @@ static void async_trigger(struct event_context *ev, struct timed_event *te, * conventions, independent of whether the request was actually deferred. */ -bool async_post_status(struct async_req *req, NTSTATUS status) +bool async_post_status(struct async_req *req, struct event_context *ev, + NTSTATUS status) { req->status = status; - if (event_add_timed(req->event_ctx, req, timeval_zero(), - "async_trigger", + if (event_add_timed(ev, req, timeval_zero(), "async_trigger", async_trigger, req) == NULL) { return false; } diff --git a/source3/lib/async_sock.c b/source3/lib/async_sock.c index 3e9d6f7904..cb545854dd 100644 --- a/source3/lib/async_sock.c +++ b/source3/lib/async_sock.c @@ -106,7 +106,7 @@ static struct async_req *async_syscall_new(TALLOC_CTX *mem_ctx, struct async_req *result; struct async_syscall_state *state; - result = async_req_new(mem_ctx, ev); + result = async_req_new(mem_ctx); if (result == NULL) { return NULL; } @@ -628,7 +628,8 @@ struct async_req *async_connect(TALLOC_CTX *mem_ctx, struct event_context *ev, p->old_sockflags = sys_fcntl_long(fd, F_GETFL, 0); if (p->old_sockflags == -1) { - if (async_post_status(result, map_nt_error_from_unix(errno))) { + if (async_post_status(result, ev, + map_nt_error_from_unix(errno))) { return result; } TALLOC_FREE(result); @@ -641,7 +642,7 @@ struct async_req *async_connect(TALLOC_CTX *mem_ctx, struct event_context *ev, if (state->result.result_int == 0) { state->sys_errno = 0; - if (async_post_status(result, NT_STATUS_OK)) { + if (async_post_status(result, ev, NT_STATUS_OK)) { return result; } sys_fcntl_long(fd, F_SETFL, p->old_sockflags); @@ -664,7 +665,8 @@ struct async_req *async_connect(TALLOC_CTX *mem_ctx, struct event_context *ev, state->sys_errno = errno; - if (async_post_status(result, map_nt_error_from_unix(errno))) { + if (async_post_status(result, ev, + map_nt_error_from_unix(errno))) { return result; } sys_fcntl_long(fd, F_SETFL, p->old_sockflags); -- cgit