mirror of
https://github.com/samba-team/samba.git
synced 2025-02-26 21:57:41 +03:00
Convert wb_req_write to tevent_req
This commit is contained in:
parent
f5ee31602c
commit
9a64d7cfbe
@ -50,11 +50,11 @@ struct async_req *wb_req_read_send(TALLOC_CTX *mem_ctx,
|
||||
wbcErr wb_req_read_recv(struct async_req *req, TALLOC_CTX *mem_ctx,
|
||||
struct winbindd_request **preq);
|
||||
|
||||
struct async_req *wb_req_write_send(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev, int fd,
|
||||
struct tevent_req *wb_req_write_send(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct tevent_queue *queue, int fd,
|
||||
struct winbindd_request *wb_req);
|
||||
|
||||
wbcErr wb_req_write_recv(struct async_req *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);
|
||||
|
@ -222,17 +222,17 @@ struct req_write_state {
|
||||
|
||||
static void wb_req_write_done(struct tevent_req *subreq);
|
||||
|
||||
struct async_req *wb_req_write_send(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev, int fd,
|
||||
struct tevent_req *wb_req_write_send(TALLOC_CTX *mem_ctx,
|
||||
struct tevent_context *ev,
|
||||
struct tevent_queue *queue, int fd,
|
||||
struct winbindd_request *wb_req)
|
||||
{
|
||||
struct async_req *result;
|
||||
struct tevent_req *subreq;
|
||||
struct tevent_req *result, *subreq;
|
||||
struct req_write_state *state;
|
||||
int count = 1;
|
||||
|
||||
if (!async_req_setup(mem_ctx, &result, &state,
|
||||
struct req_write_state)) {
|
||||
result = tevent_req_create(mem_ctx, &state, struct req_write_state);
|
||||
if (result == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -245,7 +245,7 @@ struct async_req *wb_req_write_send(TALLOC_CTX *mem_ctx,
|
||||
count = 2;
|
||||
}
|
||||
|
||||
subreq = writev_send(state, ev, NULL, fd, state->iov, count);
|
||||
subreq = writev_send(state, ev, queue, fd, state->iov, count);
|
||||
if (subreq == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
@ -259,23 +259,23 @@ struct async_req *wb_req_write_send(TALLOC_CTX *mem_ctx,
|
||||
|
||||
static void wb_req_write_done(struct tevent_req *subreq)
|
||||
{
|
||||
struct async_req *req =
|
||||
tevent_req_callback_data(subreq, struct async_req);
|
||||
struct tevent_req *req = tevent_req_callback_data(
|
||||
subreq, struct tevent_req);
|
||||
int err;
|
||||
ssize_t ret;
|
||||
|
||||
ret = writev_recv(subreq, &err);
|
||||
TALLOC_FREE(subreq);
|
||||
if (ret < 0) {
|
||||
async_req_error(req, map_wbc_err_from_errno(err));
|
||||
tevent_req_error(req, map_wbc_err_from_errno(err));
|
||||
return;
|
||||
}
|
||||
async_req_done(req);
|
||||
tevent_req_done(req);
|
||||
}
|
||||
|
||||
wbcErr wb_req_write_recv(struct async_req *req)
|
||||
wbcErr wb_req_write_recv(struct tevent_req *req)
|
||||
{
|
||||
return async_req_simple_recv_wbcerr(req);
|
||||
return tevent_req_simple_recv_wbcerr(req);
|
||||
}
|
||||
|
||||
struct resp_read_state {
|
||||
|
@ -294,7 +294,7 @@ struct wb_int_trans_state {
|
||||
struct winbindd_response *wb_resp;
|
||||
};
|
||||
|
||||
static void wb_int_trans_write_done(struct async_req *subreq);
|
||||
static void wb_int_trans_write_done(struct tevent_req *subreq);
|
||||
static void wb_int_trans_read_done(struct async_req *subreq);
|
||||
|
||||
static struct async_req *wb_int_trans_send(TALLOC_CTX *mem_ctx,
|
||||
@ -302,7 +302,7 @@ static struct async_req *wb_int_trans_send(TALLOC_CTX *mem_ctx,
|
||||
struct winbindd_request *wb_req)
|
||||
{
|
||||
struct async_req *result;
|
||||
struct async_req *subreq;
|
||||
struct tevent_req *subreq;
|
||||
struct wb_int_trans_state *state;
|
||||
|
||||
if (!async_req_setup(mem_ctx, &result, &state,
|
||||
@ -325,12 +325,12 @@ static struct async_req *wb_int_trans_send(TALLOC_CTX *mem_ctx,
|
||||
state->wb_req->length = sizeof(struct winbindd_request);
|
||||
state->wb_req->pid = getpid();
|
||||
|
||||
subreq = wb_req_write_send(state, state->ev, state->fd, state->wb_req);
|
||||
subreq = wb_req_write_send(state, state->ev, NULL, state->fd,
|
||||
state->wb_req);
|
||||
if (subreq == NULL) {
|
||||
goto fail;
|
||||
}
|
||||
subreq->async.fn = wb_int_trans_write_done;
|
||||
subreq->async.priv = result;
|
||||
tevent_req_set_callback(subreq, wb_int_trans_write_done, result);
|
||||
|
||||
return result;
|
||||
|
||||
@ -339,12 +339,13 @@ static struct async_req *wb_int_trans_send(TALLOC_CTX *mem_ctx,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void wb_int_trans_write_done(struct async_req *subreq)
|
||||
static void wb_int_trans_write_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);
|
||||
struct async_req *subreq2;
|
||||
wbcErr wbc_err;
|
||||
|
||||
wbc_err = wb_req_write_recv(subreq);
|
||||
@ -354,12 +355,12 @@ static void wb_int_trans_write_done(struct async_req *subreq)
|
||||
return;
|
||||
}
|
||||
|
||||
subreq = wb_resp_read_send(state, state->ev, state->fd);
|
||||
if (subreq == NULL) {
|
||||
async_req_error(req, WBC_ERR_NO_MEMORY);
|
||||
subreq2 = wb_resp_read_send(state, state->ev, state->fd);
|
||||
if (async_req_nomem(subreq2, req)) {
|
||||
return;
|
||||
}
|
||||
subreq->async.fn = wb_int_trans_read_done;
|
||||
subreq->async.priv = req;
|
||||
subreq2->async.fn = wb_int_trans_read_done;
|
||||
subreq2->async.priv = req;
|
||||
}
|
||||
|
||||
static void wb_int_trans_read_done(struct async_req *subreq)
|
||||
|
Loading…
x
Reference in New Issue
Block a user