diff options
author | Niels Provos <provos@gmail.com> | 2009-11-19 21:14:31 +0000 |
---|---|---|
committer | Niels Provos <provos@gmail.com> | 2009-11-19 21:14:31 +0000 |
commit | b8f222e055bbba81790ebf13d294cc30a292c49b (patch) | |
tree | 62c867e8cb7544e51f451d488c76f78ab4fac16f /http.c | |
parent | bdfe72f3c5fe085806e53acc5d1bf8d39d16e252 (diff) | |
download | libevent-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.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 */ |