summaryrefslogtreecommitdiff
path: root/bufferevent_async.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-08-18 15:18:14 -0400
committerNick Mathewson <nickm@torproject.org>2011-08-18 15:18:14 -0400
commit0d10804465ccdbaa2c94efc30f052a4e0391b208 (patch)
tree4a309d1a8a8ee0b9cdc8711f401582cf4bcec688 /bufferevent_async.c
parentec670c15a7d7c41866edf45faf98448852257a4b (diff)
parent6736852eaa0e6df52b32eb2ed666688ca8d80429 (diff)
downloadlibevent-0d10804465ccdbaa2c94efc30f052a4e0391b208.tar.gz
Merge remote-tracking branch 'origin/patches-2.0'
Diffstat (limited to 'bufferevent_async.c')
-rw-r--r--bufferevent_async.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/bufferevent_async.c b/bufferevent_async.c
index 81cc0b72..a31d6072 100644
--- a/bufferevent_async.c
+++ b/bufferevent_async.c
@@ -189,7 +189,7 @@ bev_async_consider_writing(struct bufferevent_async *beva)
/* Don't write if there's a write in progress, or we do not
* want to write, or when there's nothing left to write. */
- if (beva->write_in_progress)
+ if (beva->write_in_progress || beva->bev.connecting)
return;
if (!beva->ok || !(bev->enabled&EV_WRITE) ||
!evbuffer_get_length(bev->output)) {
@@ -235,7 +235,7 @@ bev_async_consider_reading(struct bufferevent_async *beva)
/* Don't read if there is a read in progress, or we do not
* want to read. */
- if (beva->read_in_progress)
+ if (beva->read_in_progress || beva->bev.connecting)
return;
if (!beva->ok || !(bev->enabled&EV_READ)) {
bev_async_del_read(beva);
@@ -325,7 +325,11 @@ be_async_enable(struct bufferevent *buf, short what)
if (!bev_async->ok)
return -1;
- /* NOTE: This interferes with non-blocking connect */
+ if (bev_async->bev.connecting) {
+ /* Don't launch anything during connection attempts. */
+ return 0;
+ }
+
if (what & EV_READ)
BEV_RESET_GENERIC_READ_TIMEOUT(buf);
if (what & EV_WRITE)