diff options
author | Andrew Bartlett <abartlet@samba.org> | 2009-03-10 10:59:14 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-03-10 10:59:14 +1100 |
commit | c218d3e1173355acf025471a10b4b6425b9c086b (patch) | |
tree | 3e5be3c411ebe2575914f7866c91bad81f711154 /lib/async_req/async_sock.c | |
parent | 6ac77d19b5a25a53459a58e4828fa9eac0bf11f4 (diff) | |
parent | 218ce0e80532b0dbc595e72502d9596a35acdffd (diff) | |
download | samba-c218d3e1173355acf025471a10b4b6425b9c086b.tar.gz samba-c218d3e1173355acf025471a10b4b6425b9c086b.tar.bz2 samba-c218d3e1173355acf025471a10b4b6425b9c086b.zip |
Merge branch 'master' of ssh://git.samba.org/data/git/samba into wspp-schema
Diffstat (limited to 'lib/async_req/async_sock.c')
-rw-r--r-- | lib/async_req/async_sock.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/async_req/async_sock.c b/lib/async_req/async_sock.c index 424da952eb..f803b9cc36 100644 --- a/lib/async_req/async_sock.c +++ b/lib/async_req/async_sock.c @@ -379,11 +379,13 @@ struct writev_state { size_t total_size; }; +static void writev_trigger(struct tevent_req *req, void *private_data); static void writev_handler(struct tevent_context *ev, struct tevent_fd *fde, uint16_t flags, void *private_data); struct tevent_req *writev_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - int fd, struct iovec *iov, int count) + struct tevent_queue *queue, int fd, + struct iovec *iov, int count) { struct tevent_req *result; struct writev_state *state; @@ -403,18 +405,42 @@ struct tevent_req *writev_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, goto fail; } + /* + * This if () should go away once our callers are converted to always + * pass in a queue. + */ + + if (queue != NULL) { + if (!tevent_queue_add(queue, ev, result, writev_trigger, + NULL)) { + goto fail; + } + return result; + } + fde = tevent_add_fd(ev, state, fd, TEVENT_FD_WRITE, writev_handler, result); if (fde == NULL) { goto fail; } return result; - fail: TALLOC_FREE(result); return NULL; } +static void writev_trigger(struct tevent_req *req, void *private_data) +{ + struct writev_state *state = tevent_req_data(req, struct writev_state); + struct tevent_fd *fde; + + fde = tevent_add_fd(state->ev, state, state->fd, TEVENT_FD_WRITE, + writev_handler, req); + if (fde == NULL) { + tevent_req_error(req, ENOMEM); + } +} + static void writev_handler(struct tevent_context *ev, struct tevent_fd *fde, uint16_t flags, void *private_data) { |