diff options
author | Roger Dingledine <arma@torproject.org> | 2008-09-09 06:25:39 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2008-09-09 06:25:39 +0000 |
commit | d37fae2f4edb03095f943577f78b518f75f6ca71 (patch) | |
tree | 65affa5651b1e0b1de42fe96ef4245974fbfbcc3 /src/or/connection.c | |
parent | aacda9cd8eae992c9359279782234dd626415948 (diff) | |
download | tor-d37fae2f4edb03095f943577f78b518f75f6ca71.tar.gz tor-d37fae2f4edb03095f943577f78b518f75f6ca71.zip |
Catch and report a few more bootstrapping failure cases when Tor
fails to establish a TCP connection. Cleanup on 0.2.1.x.
svn:r16803
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index 7365e77c7c..75886c7e0c 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -547,14 +547,7 @@ connection_about_to_close_connection(connection_t *conn) entry_guard_register_connect_status(or_conn->identity_digest,0,now); if (!options->HttpsProxy) router_set_status(or_conn->identity_digest, 0); - if (conn->state == OR_CONN_STATE_CONNECTING) { - control_event_or_conn_status(or_conn, OR_CONN_EVENT_FAILED, - errno_to_orconn_end_reason(or_conn->socket_error)); - if (!authdir_mode_tests_reachability(options)) - control_event_bootstrap_problem( - tor_socket_strerror(or_conn->socket_error), - errno_to_orconn_end_reason(or_conn->socket_error)); - } else { + if (conn->state >= OR_CONN_STATE_TLS_HANDSHAKING) { int reason = tls_error_to_orconn_end_reason(or_conn->tls_error); control_event_or_conn_status(or_conn, OR_CONN_EVENT_FAILED, reason); @@ -1947,8 +1940,13 @@ loop_again: before = buf_datalen(conn->inbuf); if (connection_read_to_buf(conn, &max_to_read) < 0) { /* There's a read error; kill the connection.*/ - if (conn->type == CONN_TYPE_OR) - TO_OR_CONN(conn)->socket_error = tor_socket_errno(conn->s); + if (conn->type == CONN_TYPE_OR && + conn->state == OR_CONN_STATE_CONNECTING) { + int socket_error = tor_socket_errno(conn->s); + connection_or_connect_failed(TO_OR_CONN(conn), + errno_to_orconn_end_reason(socket_error), + tor_socket_strerror(socket_error)); + } if (CONN_IS_EDGE(conn)) { edge_connection_t *edge_conn = TO_EDGE_CONN(conn); connection_edge_end_errno(edge_conn); @@ -2254,7 +2252,9 @@ connection_handle_write(connection_t *conn, int force) if (CONN_IS_EDGE(conn)) connection_edge_end_errno(TO_EDGE_CONN(conn)); if (conn->type == CONN_TYPE_OR) - TO_OR_CONN(conn)->socket_error = e; + connection_or_connect_failed(TO_OR_CONN(conn), + errno_to_orconn_end_reason(e), + tor_socket_strerror(e)); connection_close_immediate(conn); connection_mark_for_close(conn); |