Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 317 lines (269 sloc) 8.281 kB
838d0a8 Document many internal functions and pieces of code.
Nick Mathewson authored
1 /*
17efc1c Update all our copyright notices to say "2010"
Nick Mathewson authored
2 * Copyright (c) 2009-2010 Niels Provos and Nick Mathewson
838d0a8 Document many internal functions and pieces of code.
Nick Mathewson authored
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 3. The name of the author may not be used to endorse or promote products
13 * derived from this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27 /**
28 @file buffer_iocp.c
29
30 This module implements overlapped read and write functions for evbuffer
31 objects on Windows.
32 */
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
33
34 #include "event2/buffer.h"
af8b822 Add missing include to buffer_iocp.c
Nick Mathewson authored
35 #include "event2/buffer_compat.h"
93d4f88 Make buffer iocp stuff compile happily
Nick Mathewson authored
36 #include "event2/util.h"
37 #include "event2/thread.h"
ec347b9 Move event-config.h to include/event2
Nick Mathewson authored
38 #include "event2/event-config.h"
93d4f88 Make buffer iocp stuff compile happily
Nick Mathewson authored
39 #include "util-internal.h"
40 #include "evthread-internal.h"
41 #include "evbuffer-internal.h"
42 #include "iocp-internal.h"
43 #include "mm-internal.h"
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
44
5b5b880 Various MSVC cleanups from Brodie Thiesfield.
Nick Mathewson authored
45 #include <winsock2.h>
e865eb9 More msvc build tweaks.
Nick Mathewson authored
46 #include <windows.h>
47 #include <stdio.h>
48
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
49 #define MAX_WSABUFS 16
50
838d0a8 Document many internal functions and pieces of code.
Nick Mathewson authored
51 /** An evbuffer that can handle overlapped IO. */
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
52 struct evbuffer_overlapped {
53 struct evbuffer buffer;
838d0a8 Document many internal functions and pieces of code.
Nick Mathewson authored
54 /** The socket that we're doing overlapped IO on. */
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
55 evutil_socket_t fd;
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
56
57 /** pending I/O type */
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
58 unsigned read_in_progress : 1;
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
59 unsigned write_in_progress : 1;
60
61 /** The first pinned chain in the buffer. */
62 struct evbuffer_chain *first_pinned;
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
63
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
64 /** How many chains are pinned; how many of the fields in buffers
65 * are we using. */
66 int n_buffers;
67 WSABUF buffers[MAX_WSABUFS];
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
68 };
69
838d0a8 Document many internal functions and pieces of code.
Nick Mathewson authored
70 /** Given an evbuffer, return the correponding evbuffer structure, or NULL if
71 * the evbuffer isn't overlapped. */
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
72 static inline struct evbuffer_overlapped *
73 upcast_evbuffer(struct evbuffer *buf)
74 {
23121bf Fix a reversed check in upcast_evbuffer
Nick Mathewson authored
75 if (!buf || !buf->is_overlapped)
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
76 return NULL;
77 return EVUTIL_UPCAST(buf, struct evbuffer_overlapped, buffer);
78 }
79
838d0a8 Document many internal functions and pieces of code.
Nick Mathewson authored
80 /** Unpin all the chains noted as pinned in 'eo'. */
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
81 static void
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
82 pin_release(struct evbuffer_overlapped *eo, unsigned flag)
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
83 {
84 int i;
03afa20 @chris-davis IOCP-related evbuffer fixes.
chris-davis authored
85 struct evbuffer_chain *next, *chain = eo->first_pinned;
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
86
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
87 for (i = 0; i < eo->n_buffers; ++i) {
2e36dbe Use EVUTIL_ASSERT() consistently instead of assert.
Nick Mathewson authored
88 EVUTIL_ASSERT(chain);
03afa20 @chris-davis IOCP-related evbuffer fixes.
chris-davis authored
89 next = chain->next;
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
90 _evbuffer_chain_unpin(chain, flag);
03afa20 @chris-davis IOCP-related evbuffer fixes.
chris-davis authored
91 chain = next;
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
92 }
93 }
94
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
95 void
96 evbuffer_commit_read(struct evbuffer *evbuf, ev_ssize_t nBytes)
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
97 {
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
98 struct evbuffer_overlapped *buf = upcast_evbuffer(evbuf);
03afa20 @chris-davis IOCP-related evbuffer fixes.
chris-davis authored
99 struct evbuffer_chain **chainp;
100 size_t remaining, len;
101 unsigned i;
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
102
76cd2b7 Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks.
Nick Mathewson authored
103 EVBUFFER_LOCK(evbuf);
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
104 EVUTIL_ASSERT(buf->read_in_progress && !buf->write_in_progress);
e2ca403 Make it compile under gcc --std=c89.
Nick Mathewson authored
105 EVUTIL_ASSERT(nBytes >= 0); /* XXXX Can this be false? */
a84c87d Refactor IOCP callback interface
Nick Mathewson authored
106
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
107 evbuffer_unfreeze(evbuf, 0);
108
03afa20 @chris-davis IOCP-related evbuffer fixes.
chris-davis authored
109 chainp = evbuf->last_with_datap;
110 if (!((*chainp)->flags & EVBUFFER_MEM_PINNED_R))
111 chainp = &(*chainp)->next;
112 remaining = nBytes;
113 for (i = 0; remaining > 0 && i < buf->n_buffers; ++i) {
114 EVUTIL_ASSERT(*chainp);
115 len = buf->buffers[i].len;
116 if (remaining < len)
117 len = remaining;
118 (*chainp)->off += len;
119 evbuf->last_with_datap = chainp;
120 remaining -= len;
121 chainp = &(*chainp)->next;
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
122 }
123
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
124 pin_release(buf, EVBUFFER_MEM_PINNED_R);
125
126 buf->read_in_progress = 0;
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
127
03afa20 @chris-davis IOCP-related evbuffer fixes.
chris-davis authored
128 evbuf->total_len += nBytes;
129
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
130 _evbuffer_decref_and_unlock(evbuf);
131 }
132
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
133 void
134 evbuffer_commit_write(struct evbuffer *evbuf, ev_ssize_t nBytes)
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
135 {
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
136 struct evbuffer_overlapped *buf = upcast_evbuffer(evbuf);
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
137
76cd2b7 Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks.
Nick Mathewson authored
138 EVBUFFER_LOCK(evbuf);
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
139 EVUTIL_ASSERT(buf->write_in_progress && !buf->read_in_progress);
93d4f88 Make buffer iocp stuff compile happily
Nick Mathewson authored
140 evbuffer_unfreeze(evbuf, 1);
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
141 evbuffer_drain(evbuf, nBytes);
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
142 pin_release(buf,EVBUFFER_MEM_PINNED_W);
143 buf->write_in_progress = 0;
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
144 _evbuffer_decref_and_unlock(evbuf);
145 }
146
147 struct evbuffer *
148 evbuffer_overlapped_new(evutil_socket_t fd)
149 {
150 struct evbuffer_overlapped *evo;
151
152 evo = mm_calloc(1, sizeof(struct evbuffer_overlapped));
153
93d4f88 Make buffer iocp stuff compile happily
Nick Mathewson authored
154 TAILQ_INIT(&evo->buffer.callbacks);
efc24f7 Get launch_read and launch_write to (apparently) work.
Nick Mathewson authored
155 evo->buffer.refcnt = 1;
a0983b6 Initialize last_with_datap correctly in evbuffer_overlapped
Nick Mathewson authored
156 evo->buffer.last_with_datap = &evo->buffer.first;
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
157
158 evo->buffer.is_overlapped = 1;
efc24f7 Get launch_read and launch_write to (apparently) work.
Nick Mathewson authored
159 evo->fd = fd;
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
160
161 return &evo->buffer;
162 }
163
164 int
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
165 evbuffer_launch_write(struct evbuffer *buf, ev_ssize_t at_most,
166 struct event_overlapped *ol)
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
167 {
168 struct evbuffer_overlapped *buf_o = upcast_evbuffer(buf);
169 int r = -1;
93d4f88 Make buffer iocp stuff compile happily
Nick Mathewson authored
170 int i;
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
171 struct evbuffer_chain *chain;
93d4f88 Make buffer iocp stuff compile happily
Nick Mathewson authored
172 DWORD bytesSent;
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
173
174 if (!buf) {
175 /* No buffer, or it isn't overlapped */
176 return -1;
177 }
178
76cd2b7 Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks.
Nick Mathewson authored
179 EVBUFFER_LOCK(buf);
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
180 EVUTIL_ASSERT(!buf_o->read_in_progress);
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
181 if (buf->freeze_start || buf_o->write_in_progress)
182 goto done;
183 if (!buf->total_len) {
184 /* Nothing to write */
185 r = 0;
186 goto done;
e865eb9 More msvc build tweaks.
Nick Mathewson authored
187 } else if (at_most < 0 || (size_t)at_most > buf->total_len) {
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
188 at_most = buf->total_len;
189 }
190 evbuffer_freeze(buf, 1);
191
03afa20 @chris-davis IOCP-related evbuffer fixes.
chris-davis authored
192 buf_o->first_pinned = NULL;
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
193 buf_o->n_buffers = 0;
194 memset(buf_o->buffers, 0, sizeof(buf_o->buffers));
195
196 chain = buf_o->first_pinned = buf->first;
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
197
198 for (i=0; i < MAX_WSABUFS && chain; ++i, chain=chain->next) {
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
199 WSABUF *b = &buf_o->buffers[i];
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
200 b->buf = chain->buffer + chain->misalign;
201 _evbuffer_chain_pin(chain, EVBUFFER_MEM_PINNED_W);
202
e865eb9 More msvc build tweaks.
Nick Mathewson authored
203 if ((size_t)at_most > chain->off) {
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
204 b->len = chain->off;
205 at_most -= chain->off;
206 } else {
207 b->len = at_most;
208 ++i;
209 break;
210 }
211 }
212
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
213 buf_o->n_buffers = i;
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
214 _evbuffer_incref(buf);
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
215 if (WSASend(buf_o->fd, buf_o->buffers, i, &bytesSent, 0,
216 &ol->overlapped, NULL)) {
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
217 int error = WSAGetLastError();
218 if (error != WSA_IO_PENDING) {
219 /* An actual error. */
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
220 pin_release(buf_o, EVBUFFER_MEM_PINNED_W);
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
221 evbuffer_unfreeze(buf, 1);
222 evbuffer_free(buf); /* decref */
223 goto done;
224 }
225 }
226
227 buf_o->write_in_progress = 1;
228 r = 0;
229 done:
76cd2b7 Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks.
Nick Mathewson authored
230 EVBUFFER_UNLOCK(buf);
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
231 return r;
232 }
233
234 int
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
235 evbuffer_launch_read(struct evbuffer *buf, size_t at_most,
236 struct event_overlapped *ol)
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
237 {
238 struct evbuffer_overlapped *buf_o = upcast_evbuffer(buf);
23243b8 Replace reserve/commit with new iovec-based interface. Add a new evb…
Nick Mathewson authored
239 int r = -1, i;
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
240 int nvecs;
efc24f7 Get launch_read and launch_write to (apparently) work.
Nick Mathewson authored
241 int npin=0;
b7442f8 Replace last_with_data with a slightly smarter version
Nick Mathewson authored
242 struct evbuffer_chain *chain=NULL, **chainp;
93d4f88 Make buffer iocp stuff compile happily
Nick Mathewson authored
243 DWORD bytesRead;
244 DWORD flags = 0;
7a84473 Fix some small win32 build issues on trunk.
Nick Mathewson authored
245 struct evbuffer_iovec vecs[MAX_WSABUFS];
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
246
efc24f7 Get launch_read and launch_write to (apparently) work.
Nick Mathewson authored
247 if (!buf_o)
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
248 return -1;
76cd2b7 Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks.
Nick Mathewson authored
249 EVBUFFER_LOCK(buf);
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
250 EVUTIL_ASSERT(!buf_o->write_in_progress);
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
251 if (buf->freeze_end || buf_o->read_in_progress)
252 goto done;
253
03afa20 @chris-davis IOCP-related evbuffer fixes.
chris-davis authored
254 buf_o->first_pinned = NULL;
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
255 buf_o->n_buffers = 0;
256 memset(buf_o->buffers, 0, sizeof(buf_o->buffers));
257
03afa20 @chris-davis IOCP-related evbuffer fixes.
chris-davis authored
258 if (_evbuffer_expand_fast(buf, at_most, MAX_WSABUFS) == -1)
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
259 goto done;
260 evbuffer_freeze(buf, 0);
261
93d4f88 Make buffer iocp stuff compile happily
Nick Mathewson authored
262 nvecs = _evbuffer_read_setup_vecs(buf, at_most,
03afa20 @chris-davis IOCP-related evbuffer fixes.
chris-davis authored
263 vecs, MAX_WSABUFS, &chainp, 1);
23243b8 Replace reserve/commit with new iovec-based interface. Add a new evb…
Nick Mathewson authored
264 for (i=0;i<nvecs;++i) {
8997f23 Use the native "struct iovec" as our "struct evbuffer_iovec" when ava…
Nick Mathewson authored
265 WSABUF_FROM_EVBUFFER_IOV(
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
266 &buf_o->buffers[i],
23243b8 Replace reserve/commit with new iovec-based interface. Add a new evb…
Nick Mathewson authored
267 &vecs[i]);
268 }
269
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
270 buf_o->n_buffers = nvecs;
03afa20 @chris-davis IOCP-related evbuffer fixes.
chris-davis authored
271 buf_o->first_pinned = chain = *chainp;
272
efc24f7 Get launch_read and launch_write to (apparently) work.
Nick Mathewson authored
273 npin=0;
274 for ( ; chain; chain = chain->next) {
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
275 _evbuffer_chain_pin(chain, EVBUFFER_MEM_PINNED_R);
efc24f7 Get launch_read and launch_write to (apparently) work.
Nick Mathewson authored
276 ++npin;
277 }
2e36dbe Use EVUTIL_ASSERT() consistently instead of assert.
Nick Mathewson authored
278 EVUTIL_ASSERT(npin == nvecs);
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
279
280 _evbuffer_incref(buf);
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
281 if (WSARecv(buf_o->fd, buf_o->buffers, nvecs, &bytesRead, &flags,
e5bbd40 Clean up formatting: use tabs, not 8-spaces, to indent.
Nick Mathewson authored
282 &ol->overlapped, NULL)) {
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
283 int error = WSAGetLastError();
284 if (error != WSA_IO_PENDING) {
285 /* An actual error. */
d7d1f1d Move responsibility for IOCP callback into bufferevent_async.
Nick Mathewson authored
286 pin_release(buf_o, EVBUFFER_MEM_PINNED_R);
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
287 evbuffer_unfreeze(buf, 0);
288 evbuffer_free(buf); /* decref */
289 goto done;
290 }
291 }
292
293 buf_o->read_in_progress = 1;
294 r = 0;
295 done:
76cd2b7 Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks.
Nick Mathewson authored
296 EVBUFFER_UNLOCK(buf);
ca737ff Add draft (nonworking) versions of iocp code to hack on more.
Nick Mathewson authored
297 return r;
298 }
299
31d89f2 Add a "ctrl" mechanism to bufferevents for property access.
Nick Mathewson authored
300 evutil_socket_t
301 _evbuffer_overlapped_get_fd(struct evbuffer *buf)
302 {
303 struct evbuffer_overlapped *buf_o = upcast_evbuffer(buf);
304 return buf_o ? buf_o->fd : -1;
305 }
86db1c8 Commit ConnectEx code to get connect working with async bufferevents.
Nick Mathewson authored
306
307 void
308 _evbuffer_overlapped_set_fd(struct evbuffer *buf, evutil_socket_t fd)
309 {
310 struct evbuffer_overlapped *buf_o = upcast_evbuffer(buf);
76cd2b7 Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks.
Nick Mathewson authored
311 EVBUFFER_LOCK(buf);
86db1c8 Commit ConnectEx code to get connect working with async bufferevents.
Nick Mathewson authored
312 /* XXX is this right?, should it cancel current I/O operations? */
313 if (buf_o)
314 buf_o->fd = fd;
76cd2b7 Stop passing EVTHREAD_READ and EVTHREAD_WRITE to non-rw locks.
Nick Mathewson authored
315 EVBUFFER_UNLOCK(buf);
86db1c8 Commit ConnectEx code to get connect working with async bufferevents.
Nick Mathewson authored
316 }
Something went wrong with that request. Please try again.