diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-11-17 20:31:09 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-11-17 20:31:09 +0000 |
commit | d7d1f1da09f32a14ff4c08dc0f1f0e0673ed5afd (patch) | |
tree | d02c3c5d7a4a50299aeaae5c3b7ea41d7cce6945 /iocp-internal.h | |
parent | 201d8d0bafeb2ba1388746ed745cd5d8defb3689 (diff) | |
download | libevent-d7d1f1da09f32a14ff4c08dc0f1f0e0673ed5afd.tar.gz |
Move responsibility for IOCP callback into bufferevent_async.
This patch from Chris Davis saves some callback depth, and adds proper
ref-counting to bufferevents when there's a deferred evbuffer callback
inflight. It could use a couple more comments to really nail down what
its invariants are.
svn:r1543
Diffstat (limited to 'iocp-internal.h')
-rw-r--r-- | iocp-internal.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/iocp-internal.h b/iocp-internal.h index c0500ace..0f8d3c81 100644 --- a/iocp-internal.h +++ b/iocp-internal.h @@ -124,24 +124,32 @@ void _evbuffer_overlapped_set_fd(struct evbuffer *buf, evutil_socket_t fd); An evbuffer can only have one read pending at a time. While the read is in progress, no other data may be added to the end of the buffer. The buffer must be created with event_overlapped_init(). + evbuffer_commit_read() must be called in the completion callback. @param buf The buffer to read onto @param n The number of bytes to try to read. + @param ol Overlapped object with associated completion callback. @return 0 on success, -1 on error. */ -int evbuffer_launch_read(struct evbuffer *, size_t n); +int evbuffer_launch_read(struct evbuffer *buf, size_t n, struct event_overlapped *ol); /** Start writing data from the start of an evbuffer. An evbuffer can only have one write pending at a time. While the write is in progress, no other data may be removed from the front of the buffer. The buffer must be created with event_overlapped_init(). + evbuffer_commit_write() must be called in the completion callback. @param buf The buffer to read onto @param n The number of bytes to try to read. + @param ol Overlapped object with associated completion callback. @return 0 on success, -1 on error. */ -int evbuffer_launch_write(struct evbuffer *, ev_ssize_t n); +int evbuffer_launch_write(struct evbuffer *buf, ev_ssize_t n, struct event_overlapped *ol); + +/** XXX document */ +void evbuffer_commit_read(struct evbuffer *, ev_ssize_t); +void evbuffer_commit_write(struct evbuffer *, ev_ssize_t); /** Create an IOCP, and launch its worker threads. Internal use only. @@ -179,6 +187,7 @@ struct bufferevent *bufferevent_async_new(struct event_base *base, evutil_socket_t fd, int options); /* FIXME document. */ +void bufferevent_async_set_connected(struct bufferevent *bev); int bufferevent_async_can_connect(struct bufferevent *bev); int bufferevent_async_connect(struct bufferevent *bev, evutil_socket_t fd, const struct sockaddr *sa, int socklen); |