diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-03-25 16:14:42 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-03-25 18:32:28 -0400 |
commit | 6a5b94de6c51478ca638ec03c40a6d3c27f2d674 (patch) | |
tree | 14e4e6dc792d8137beac57bbfda94e2bb99b2295 /src/or/connection_edge.c | |
parent | 05887f10ffe14498e96c34d2faa535187719689f (diff) | |
download | tor-6a5b94de6c51478ca638ec03c40a6d3c27f2d674.tar.gz tor-6a5b94de6c51478ca638ec03c40a6d3c27f2d674.zip |
Look at the right errno when sending reason for connect() failure
In afe414 (tor-0.1.0.1-rc~173), when we moved to
connection_edge_end_errno(), we used it in handling errors from
connection_connect(). That's not so good, since by the time
connection_connect() returns, the socket is no longer set, and we're
supposed to be looking at the socket_errno return value from
connection_connect() instead. So do what we should've done, and
look at the socket_errno value that we get from connection_connect().
Diffstat (limited to 'src/or/connection_edge.c')
-rw-r--r-- | src/or/connection_edge.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c index 82b71395b5..c75c06bc60 100644 --- a/src/or/connection_edge.c +++ b/src/or/connection_edge.c @@ -2823,13 +2823,13 @@ connection_exit_connect(edge_connection_t *edge_conn) log_debug(LD_EXIT,"about to try connecting"); switch (connection_connect(conn, conn->address, addr, port, &socket_error)) { - case -1: - /* XXX022 use socket_error below rather than trying to piece things - * together from the current errno, which may have been clobbered. */ - connection_edge_end_errno(edge_conn); + case -1: { + int reason = errno_to_stream_end_reason(socket_error); + connection_edge_end(edge_conn, reason); circuit_detach_stream(circuit_get_by_edge_conn(edge_conn), edge_conn); connection_free(conn); return; + } case 0: conn->state = EXIT_CONN_STATE_CONNECTING; |