diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-11-02 19:51:26 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-11-02 19:51:26 +0000 |
commit | a84c87d76abcd023ddfb2c0985a65bafd522682b (patch) | |
tree | 1c3d5b5e5efad94f21db167b8490c9d9e3fda1a0 /buffer_iocp.c | |
parent | 9a772148f2efcbaadbe8ccc50a2bd5d0004f971d (diff) | |
download | libevent-a84c87d76abcd023ddfb2c0985a65bafd522682b.tar.gz |
Refactor IOCP callback interface
Chris Davis points out that GetQueuedCompletionStatus
sometimes returns false not to report "No events for
you!" but instead to report "An overlapped operation
failed." Add a way to tell an event_overlapped that
its operation failed.
svn:r1490
Diffstat (limited to 'buffer_iocp.c')
-rw-r--r-- | buffer_iocp.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/buffer_iocp.c b/buffer_iocp.c index 5071a9db..b52f84d6 100644 --- a/buffer_iocp.c +++ b/buffer_iocp.c @@ -111,7 +111,7 @@ pin_release(struct event_overlapped *eo, unsigned flag) /** IOCP callback invoked when a read operation is finished. */ static void -read_completed(struct event_overlapped *eo, uintptr_t _, ev_ssize_t nBytes) +read_completed(struct event_overlapped *eo, uintptr_t _, ev_ssize_t nBytes, int ok) { struct buffer_overlapped *buf_o = upcast_overlapped(eo); struct evbuffer_overlapped *buf = buf_o->buf; @@ -120,6 +120,8 @@ read_completed(struct event_overlapped *eo, uintptr_t _, ev_ssize_t nBytes) struct evbuffer_iovec iov[2]; int n_vec; + // XXXX use ok + EVBUFFER_LOCK(evbuf, EVTHREAD_WRITE); buf->read_in_progress = 0; evbuffer_unfreeze(evbuf, 0); @@ -145,8 +147,9 @@ read_completed(struct event_overlapped *eo, uintptr_t _, ev_ssize_t nBytes) /** IOCP callback invoked when a write operation is finished. */ static void -write_completed(struct event_overlapped *eo, uintptr_t _, ev_ssize_t nBytes) +write_completed(struct event_overlapped *eo, uintptr_t _, ev_ssize_t nBytes, int ok) { + // XXX use ok struct buffer_overlapped *buf_o = upcast_overlapped(eo); struct evbuffer_overlapped *buf = buf_o->buf; |