summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorNiels Provos <provos@gmail.com>2009-11-19 21:14:31 +0000
committerNiels Provos <provos@gmail.com>2009-11-19 21:14:31 +0000
commitb8f222e055bbba81790ebf13d294cc30a292c49b (patch)
tree62c867e8cb7544e51f451d488c76f78ab4fac16f /http.c
parentbdfe72f3c5fe085806e53acc5d1bf8d39d16e252 (diff)
downloadlibevent-b8f222e055bbba81790ebf13d294cc30a292c49b.tar.gz
On FreeBSD and other OSes, connect can return ECONREFUSED immediately; instead of failing the function call, pretend with faileld in the callback.
svn:r1553
Diffstat (limited to 'http.c')
-rw-r--r--http.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/http.c b/http.c
index 73716779..acbd0b57 100644
--- a/http.c
+++ b/http.c
@@ -1849,8 +1849,12 @@ evhttp_connection_connect(struct evhttp_connection *evcon)
if (socket_connect(evcon->fd, evcon->address, evcon->port) == -1) {
event_sock_warn(evcon->fd, "%s: connection to \"%s\" failed",
__func__, evcon->address);
- EVUTIL_CLOSESOCKET(evcon->fd); evcon->fd = -1;
- return (-1);
+ /* some operating systems return ECONNREFUSED immediately
+ * when connecting to a local address. the cleanup is going
+ * to reschedule this function call.
+ */
+ evhttp_connection_cb_cleanup(evcon);
+ return (0);
}
/* Set up a callback for successful connection setup */