diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/wbc_async.h | 7 | ||||
-rw-r--r-- | source3/lib/wb_reqtrans.c | 31 | ||||
-rw-r--r-- | source3/lib/wbclient.c | 16 |
3 files changed, 25 insertions, 29 deletions
diff --git a/source3/include/wbc_async.h b/source3/include/wbc_async.h index b355c8fc9f..27af31f27a 100644 --- a/source3/include/wbc_async.h +++ b/source3/include/wbc_async.h @@ -55,10 +55,9 @@ struct tevent_req *wb_req_write_send(TALLOC_CTX *mem_ctx, struct winbindd_request *wb_req); wbcErr wb_req_write_recv(struct tevent_req *req); -struct async_req *wb_resp_read_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, int fd); - -wbcErr wb_resp_read_recv(struct async_req *req, TALLOC_CTX *mem_ctx, +struct tevent_req *wb_resp_read_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, int fd); +wbcErr wb_resp_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, struct winbindd_response **presp); struct async_req *wb_resp_write_send(TALLOC_CTX *mem_ctx, diff --git a/source3/lib/wb_reqtrans.c b/source3/lib/wb_reqtrans.c index 30e5f75062..1f7713b02d 100644 --- a/source3/lib/wb_reqtrans.c +++ b/source3/lib/wb_reqtrans.c @@ -284,15 +284,14 @@ struct resp_read_state { static ssize_t wb_resp_more(uint8_t *buf, size_t buflen, void *private_data); static void wb_resp_read_done(struct tevent_req *subreq); -struct async_req *wb_resp_read_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, int fd) +struct tevent_req *wb_resp_read_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, int fd) { - struct async_req *result; - struct tevent_req *subreq; + struct tevent_req *result, *subreq; struct resp_read_state *state; - if (!async_req_setup(mem_ctx, &result, &state, - struct resp_read_state)) { + result = tevent_req_create(mem_ctx, &state, struct resp_read_state); + if (result == NULL) { return NULL; } @@ -326,10 +325,10 @@ static ssize_t wb_resp_more(uint8_t *buf, size_t buflen, void *private_data) static void wb_resp_read_done(struct tevent_req *subreq) { - struct async_req *req = - tevent_req_callback_data(subreq, struct async_req); - struct resp_read_state *state = talloc_get_type_abort( - req->private_data, struct resp_read_state); + struct tevent_req *req = tevent_req_callback_data( + subreq, struct tevent_req); + struct resp_read_state *state = tevent_req_data( + req, struct resp_read_state); uint8_t *buf; int err; ssize_t ret; @@ -337,7 +336,7 @@ static void wb_resp_read_done(struct tevent_req *subreq) ret = read_packet_recv(subreq, state, &buf, &err); TALLOC_FREE(subreq); if (ret == -1) { - async_req_error(req, map_wbc_err_from_errno(err)); + tevent_req_error(req, map_wbc_err_from_errno(err)); return; } @@ -349,17 +348,17 @@ static void wb_resp_read_done(struct tevent_req *subreq) } else { state->wb_resp->extra_data.data = NULL; } - async_req_done(req); + tevent_req_done(req); } -wbcErr wb_resp_read_recv(struct async_req *req, TALLOC_CTX *mem_ctx, +wbcErr wb_resp_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, struct winbindd_response **presp) { - struct resp_read_state *state = talloc_get_type_abort( - req->private_data, struct resp_read_state); + struct resp_read_state *state = tevent_req_data( + req, struct resp_read_state); wbcErr wbc_err; - if (async_req_is_wbcerr(req, &wbc_err)) { + if (tevent_req_is_wbcerr(req, &wbc_err)) { return wbc_err; } *presp = talloc_move(mem_ctx, &state->wb_resp); diff --git a/source3/lib/wbclient.c b/source3/lib/wbclient.c index 254e57b5f2..d299914c73 100644 --- a/source3/lib/wbclient.c +++ b/source3/lib/wbclient.c @@ -295,7 +295,7 @@ struct wb_int_trans_state { }; static void wb_int_trans_write_done(struct tevent_req *subreq); -static void wb_int_trans_read_done(struct async_req *subreq); +static void wb_int_trans_read_done(struct tevent_req *subreq); static struct async_req *wb_int_trans_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, int fd, @@ -345,7 +345,6 @@ static void wb_int_trans_write_done(struct tevent_req *subreq) subreq, struct async_req); struct wb_int_trans_state *state = talloc_get_type_abort( req->private_data, struct wb_int_trans_state); - struct async_req *subreq2; wbcErr wbc_err; wbc_err = wb_req_write_recv(subreq); @@ -355,18 +354,17 @@ static void wb_int_trans_write_done(struct tevent_req *subreq) return; } - subreq2 = wb_resp_read_send(state, state->ev, state->fd); - if (async_req_nomem(subreq2, req)) { + subreq = wb_resp_read_send(state, state->ev, state->fd); + if (async_req_nomem(subreq, req)) { return; } - subreq2->async.fn = wb_int_trans_read_done; - subreq2->async.priv = req; + tevent_req_set_callback(subreq, wb_int_trans_read_done, req); } -static void wb_int_trans_read_done(struct async_req *subreq) +static void wb_int_trans_read_done(struct tevent_req *subreq) { - struct async_req *req = talloc_get_type_abort( - subreq->async.priv, struct async_req); + struct async_req *req = tevent_req_callback_data( + subreq, struct async_req); struct wb_int_trans_state *state = talloc_get_type_abort( req->private_data, struct wb_int_trans_state); wbcErr wbc_err; |