diff options
-rw-r--r-- | source3/include/wbc_async.h | 9 | ||||
-rw-r--r-- | source3/lib/wb_reqtrans.c | 33 |
2 files changed, 20 insertions, 22 deletions
diff --git a/source3/include/wbc_async.h b/source3/include/wbc_async.h index b90a3b71d8..b355c8fc9f 100644 --- a/source3/include/wbc_async.h +++ b/source3/include/wbc_async.h @@ -43,11 +43,10 @@ wbcErr async_req_simple_recv_wbcerr(struct async_req *req); bool tevent_req_is_wbcerr(struct tevent_req *req, wbcErr *pwbc_err); wbcErr tevent_req_simple_recv_wbcerr(struct tevent_req *req); -struct async_req *wb_req_read_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - int fd, size_t max_extra_data); - -wbcErr wb_req_read_recv(struct async_req *req, TALLOC_CTX *mem_ctx, +struct tevent_req *wb_req_read_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + int fd, size_t max_extra_data); +wbcErr wb_req_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, struct winbindd_request **preq); struct tevent_req *wb_req_write_send(TALLOC_CTX *mem_ctx, diff --git a/source3/lib/wb_reqtrans.c b/source3/lib/wb_reqtrans.c index 9fcef0bb76..30e5f75062 100644 --- a/source3/lib/wb_reqtrans.c +++ b/source3/lib/wb_reqtrans.c @@ -121,16 +121,15 @@ wbcErr tevent_req_simple_recv_wbcerr(struct tevent_req *req) static ssize_t wb_req_more(uint8_t *buf, size_t buflen, void *private_data); static void wb_req_read_done(struct tevent_req *subreq); -struct async_req *wb_req_read_send(TALLOC_CTX *mem_ctx, - struct tevent_context *ev, - int fd, size_t max_extra_data) +struct tevent_req *wb_req_read_send(TALLOC_CTX *mem_ctx, + struct tevent_context *ev, + int fd, size_t max_extra_data) { - struct async_req *result; - struct tevent_req *subreq; + struct tevent_req *result, *subreq; struct req_read_state *state; - if (!async_req_setup(mem_ctx, &result, &state, - struct req_read_state)) { + result = tevent_req_create(mem_ctx, &state, struct req_read_state); + if (result == NULL) { return NULL; } state->max_extra_data = max_extra_data; @@ -176,10 +175,10 @@ static ssize_t wb_req_more(uint8_t *buf, size_t buflen, void *private_data) static void wb_req_read_done(struct tevent_req *subreq) { - struct async_req *req = - tevent_req_callback_data(subreq, struct async_req); - struct req_read_state *state = talloc_get_type_abort( - req->private_data, struct req_read_state); + struct tevent_req *req = tevent_req_callback_data( + subreq, struct tevent_req); + struct req_read_state *state = tevent_req_data( + req, struct req_read_state); int err; ssize_t ret; uint8_t *buf; @@ -187,7 +186,7 @@ static void wb_req_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; } @@ -199,17 +198,17 @@ static void wb_req_read_done(struct tevent_req *subreq) } else { state->wb_req->extra_data.data = NULL; } - async_req_done(req); + tevent_req_done(req); } -wbcErr wb_req_read_recv(struct async_req *req, TALLOC_CTX *mem_ctx, +wbcErr wb_req_read_recv(struct tevent_req *req, TALLOC_CTX *mem_ctx, struct winbindd_request **preq) { - struct req_read_state *state = talloc_get_type_abort( - req->private_data, struct req_read_state); + struct req_read_state *state = tevent_req_data( + req, struct req_read_state); wbcErr wbc_err; - if (async_req_is_wbcerr(req, &wbc_err)) { + if (tevent_req_is_wbcerr(req, &wbc_err)) { return wbc_err; } *preq = talloc_move(mem_ctx, &state->wb_req); |