From 50f1dc9db8fbe0da7a6c6d5dde54da08994be318 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 3 Mar 2010 15:12:05 +0100 Subject: s4:libcli/wrepl: convert wrepl_pull_names_send to tevent_req metze --- source4/wrepl_server/wrepl_out_helpers.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'source4/wrepl_server') diff --git a/source4/wrepl_server/wrepl_out_helpers.c b/source4/wrepl_server/wrepl_out_helpers.c index 7f460c56ef..08d0fa4c30 100644 --- a/source4/wrepl_server/wrepl_out_helpers.c +++ b/source4/wrepl_server/wrepl_out_helpers.c @@ -414,14 +414,14 @@ enum wreplsrv_pull_names_stage { struct wreplsrv_pull_names_state { enum wreplsrv_pull_names_stage stage; struct composite_context *c; - struct wrepl_request *req; struct wrepl_pull_names pull_io; struct wreplsrv_pull_names_io *io; struct composite_context *creq; struct wreplsrv_out_connection *wreplconn; + struct tevent_req *subreq; }; -static void wreplsrv_pull_names_handler_req(struct wrepl_request *req); +static void wreplsrv_pull_names_handler_treq(struct tevent_req *subreq); static NTSTATUS wreplsrv_pull_names_wait_connection(struct wreplsrv_pull_names_state *state) { @@ -432,11 +432,15 @@ static NTSTATUS wreplsrv_pull_names_wait_connection(struct wreplsrv_pull_names_s state->pull_io.in.assoc_ctx = state->wreplconn->assoc_ctx.peer_ctx; state->pull_io.in.partner = state->io->in.owner; - state->req = wrepl_pull_names_send(state->wreplconn->sock, &state->pull_io); - NT_STATUS_HAVE_NO_MEMORY(state->req); + state->subreq = wrepl_pull_names_send(state, + state->wreplconn->service->task->event_ctx, + state->wreplconn->sock, + &state->pull_io); + NT_STATUS_HAVE_NO_MEMORY(state->subreq); - state->req->async.fn = wreplsrv_pull_names_handler_req; - state->req->async.private_data = state; + tevent_req_set_callback(state->subreq, + wreplsrv_pull_names_handler_treq, + state); state->stage = WREPLSRV_PULL_NAMES_STAGE_WAIT_SEND_REPLY; @@ -447,7 +451,8 @@ static NTSTATUS wreplsrv_pull_names_wait_send_reply(struct wreplsrv_pull_names_s { NTSTATUS status; - status = wrepl_pull_names_recv(state->req, state, &state->pull_io); + status = wrepl_pull_names_recv(state->subreq, state, &state->pull_io); + TALLOC_FREE(state->subreq); NT_STATUS_NOT_OK_RETURN(status); state->stage = WREPLSRV_PULL_NAMES_STAGE_DONE; @@ -488,9 +493,9 @@ static void wreplsrv_pull_names_handler_creq(struct composite_context *creq) return; } -static void wreplsrv_pull_names_handler_req(struct wrepl_request *req) +static void wreplsrv_pull_names_handler_treq(struct tevent_req *subreq) { - struct wreplsrv_pull_names_state *state = talloc_get_type(req->async.private_data, + struct wreplsrv_pull_names_state *state = tevent_req_callback_data(subreq, struct wreplsrv_pull_names_state); wreplsrv_pull_names_handler(state); return; -- cgit