From 70f788ba7ea7ffa4d0808d0a299d98ee894a89a2 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 22 Feb 2009 22:01:35 +0100 Subject: Use async_writev in np_write --- source3/rpc_server/srv_pipe_hnd.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'source3/rpc_server/srv_pipe_hnd.c') diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index 6dead2d264..d33d7f64b2 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -1171,13 +1171,12 @@ NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name, struct np_write_state { struct event_context *ev; struct np_proxy_state *p; - const uint8_t *data; - size_t len; + struct iovec iov; ssize_t nwritten; }; static void np_write_trigger(struct async_req *req); -static void np_write_done(struct async_req *subreq); +static void np_write_done(struct tevent_req *subreq); struct async_req *np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev, struct fake_file_handle *handle, @@ -1218,8 +1217,8 @@ struct async_req *np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev, state->ev = ev; state->p = p; - state->data = data; - state->len = len; + state->iov.iov_base = CONST_DISCARD(void *, data); + state->iov.iov_len = len; if (!async_req_enqueue(p->write_queue, ev, result, np_write_trigger)) { @@ -1242,27 +1241,26 @@ static void np_write_trigger(struct async_req *req) { struct np_write_state *state = talloc_get_type_abort( req->private_data, struct np_write_state); - struct async_req *subreq; + struct tevent_req *subreq; - subreq = sendall_send(state, state->ev, state->p->fd, state->data, - state->len, 0); + subreq = writev_send(state, state->ev, state->p->fd, &state->iov, 1); if (async_req_nomem(subreq, req)) { return; } subreq->async.fn = np_write_done; - subreq->async.priv = req; + subreq->async.private_data = req; } -static void np_write_done(struct async_req *subreq) +static void np_write_done(struct tevent_req *subreq) { struct async_req *req = talloc_get_type_abort( - subreq->async.priv, struct async_req); + subreq->async.private_data, struct async_req); struct np_write_state *state = talloc_get_type_abort( req->private_data, struct np_write_state); ssize_t received; int err; - received = sendall_recv(subreq, &err); + received = writev_recv(subreq, &err); if (received < 0) { async_req_nterror(req, map_nt_error_from_unix(err)); return; -- cgit From 5d653f69de27ee22137333bc319ae2d7e60e56b0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 22 Feb 2009 23:17:15 +0100 Subject: Replace read_pkt by read_packet in np_read --- source3/rpc_server/srv_pipe_hnd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'source3/rpc_server/srv_pipe_hnd.c') diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index d33d7f64b2..33e89c8acb 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -1314,7 +1314,7 @@ struct np_read_state { }; static void np_read_trigger(struct async_req *req); -static void np_read_done(struct async_req *subreq); +static void np_read_done(struct tevent_req *subreq); struct async_req *np_read_send(TALLOC_CTX *mem_ctx, struct event_context *ev, struct fake_file_handle *handle, @@ -1391,28 +1391,28 @@ static void np_read_trigger(struct async_req *req) { struct np_read_state *state = talloc_get_type_abort( req->private_data, struct np_read_state); - struct async_req *subreq; + struct tevent_req *subreq; - subreq = read_pkt_send(state, state->ev, state->p->fd, RPC_HEADER_LEN, - rpc_frag_more_fn, NULL); + subreq = read_packet_send(state, state->ev, state->p->fd, + RPC_HEADER_LEN, rpc_frag_more_fn, NULL); if (async_req_nomem(subreq, req)) { return; } subreq->async.fn = np_read_done; - subreq->async.priv = req; + subreq->async.private_data = req; } -static void np_read_done(struct async_req *subreq) +static void np_read_done(struct tevent_req *subreq) { struct async_req *req = talloc_get_type_abort( - subreq->async.priv, struct async_req); + subreq->async.private_data, struct async_req); struct np_read_state *state = talloc_get_type_abort( req->private_data, struct np_read_state); ssize_t received; size_t thistime; int err; - received = read_pkt_recv(subreq, state->p, &state->p->msg, &err); + received = read_packet_recv(subreq, state->p, &state->p->msg, &err); TALLOC_FREE(subreq); if (received == -1) { async_req_nterror(req, map_nt_error_from_unix(err)); -- cgit