diff options
author | Nick Mathewson <nickm@torproject.org> | 2010-02-27 22:27:13 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2010-02-27 22:27:13 -0500 |
commit | 57b72488233f749cd402d6133b5e4b1fb83878d3 (patch) | |
tree | 2c74742801c2176e1da1fb1c4b1bdb3c5dd3d67c /bufferevent_sock.c | |
parent | 7bc48bfd3ac61aa4ff118cacb44145c6ecda366e (diff) | |
download | libevent-57b72488233f749cd402d6133b5e4b1fb83878d3.tar.gz |
Small cleanups on freebsd-connect-refused patch.
There should be no need to call be_socket_enable: that does an
event_add(). What we really want to do is event_active(), to make
sure that the writecb is executed.
Also, there was one "} if () {" that was missing an else.
I've noted that the return value for evutil_socket_connect() is
getting screwy, but since that isn't an exported function, we can fix
it whenever.
Diffstat (limited to 'bufferevent_sock.c')
-rw-r--r-- | bufferevent_sock.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/bufferevent_sock.c b/bufferevent_sock.c index 22e76032..d731086f 100644 --- a/bufferevent_sock.c +++ b/bufferevent_sock.c @@ -401,19 +401,17 @@ bufferevent_socket_connect(struct bufferevent *bev, result = 0; goto done; } - } if (r == 1) { + } else if (r == 1) { /* The connect succeeded already. How very BSD of it. */ result = 0; bufev_p->connecting = 1; event_active(&bev->ev_write, EV_WRITE, 1); } else { /* The connect failed already. How very BSD of it. */ - if (! be_socket_enable(bev, EV_WRITE)) { - bufev_p->connection_refused = 1; - bufev_p->connecting = 1; - result = 0; - goto done; - } + bufev_p->connection_refused = 1; + bufev_p->connecting = 1; + result = 0; + event_active(&bev->ev_write, EV_WRITE, 1); } goto done; |