diff options
author | Nick Mathewson <nickm@torproject.org> | 2010-03-26 23:18:40 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2010-03-31 12:50:32 -0400 |
commit | b7442f8e8354b09f66d0110f2c5c970373a730cb (patch) | |
tree | 8b123b1b4b559c35cc39a79cc13c63024d83a7d3 /buffer_iocp.c | |
parent | cda56abf194eb70f00c8e6ce95ec31f226048f9f (diff) | |
download | libevent-b7442f8e8354b09f66d0110f2c5c970373a730cb.tar.gz |
Replace last_with_data with a slightly smarter version
To implement evbuffer_expand() properly, you need to be able to
replace the last chunk that has data, which means that we need to keep
track of the the next pointer pointing to the last_with_data chunk,
not the last_with_data chunk itself.
Diffstat (limited to 'buffer_iocp.c')
-rw-r--r-- | buffer_iocp.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/buffer_iocp.c b/buffer_iocp.c index cdf2eaa5..6983a6ac 100644 --- a/buffer_iocp.c +++ b/buffer_iocp.c @@ -233,7 +233,7 @@ evbuffer_launch_read(struct evbuffer *buf, size_t at_most, int r = -1, i; int nvecs; int npin=0; - struct evbuffer_chain *chain=NULL; + struct evbuffer_chain *chain=NULL, **chainp; DWORD bytesRead; DWORD flags = 0; struct evbuffer_iovec vecs[MAX_WSABUFS]; @@ -257,7 +257,7 @@ evbuffer_launch_read(struct evbuffer *buf, size_t at_most, * not "2". But commit_read() above can't handle more than two * buffers yet. */ nvecs = _evbuffer_read_setup_vecs(buf, at_most, - vecs, 2, &chain, 1); + vecs, 2, &chainp, 1); for (i=0;i<nvecs;++i) { WSABUF_FROM_EVBUFFER_IOV( &buf_o->buffers[i], @@ -265,7 +265,7 @@ evbuffer_launch_read(struct evbuffer *buf, size_t at_most, } buf_o->n_buffers = nvecs; - buf_o->first_pinned = chain; + buf_o->first_pinned = chain= *chainp; npin=0; for ( ; chain; chain = chain->next) { _evbuffer_chain_pin(chain, EVBUFFER_MEM_PINNED_R); |