diff options
author | Roger Dingledine <arma@torproject.org> | 2008-06-09 18:32:43 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2008-06-09 18:32:43 +0000 |
commit | baa3cea213dae87197991e6d50ff53ef53e8e829 (patch) | |
tree | bab367b4318313b6814782fb7131fe86876fff62 /src/or/connection.c | |
parent | dba6d8c55aa7af6e3aabe28b54fb3fc499c1d139 (diff) | |
download | tor-baa3cea213dae87197991e6d50ff53ef53e8e829.tar.gz tor-baa3cea213dae87197991e6d50ff53ef53e8e829.zip |
Start noticing and reporting bootstrapping failures too. It looks like
we never bothered learning why OR conns fail, so next step is to add some
infrastructure for that.
svn:r15091
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index dda4f16ce8..0a6c69f2d0 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -497,9 +497,18 @@ connection_about_to_close_connection(connection_t *conn) if (connection_or_nonopen_was_started_here(or_conn)) { rep_hist_note_connect_failed(or_conn->identity_digest, now); entry_guard_register_connect_status(or_conn->identity_digest,0,now); - router_set_status(or_conn->identity_digest, 0); - control_event_or_conn_status(or_conn, OR_CONN_EVENT_FAILED, - control_tls_error_to_reason(or_conn->tls_error)); + if (!get_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, 0); + control_event_bootstrap_problem( + tor_socket_strerror(or_conn->socket_error), 0); + } else { + int reason = control_tls_error_to_reason(or_conn->tls_error); + control_event_or_conn_status(or_conn, OR_CONN_EVENT_FAILED, + reason); + control_event_bootstrap_problem("foo", reason); + } } /* Inform any pending (not attached) circs that they should * give up. */ @@ -1842,13 +1851,15 @@ 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.*/ - connection_close_immediate(conn); /* Don't flush; connection is dead. */ + if (conn->type == CONN_TYPE_OR) + TO_OR_CONN(conn)->socket_error = tor_socket_errno(conn->s); if (CONN_IS_EDGE(conn)) { edge_connection_t *edge_conn = TO_EDGE_CONN(conn); connection_edge_end_errno(edge_conn); if (edge_conn->socks_request) /* broken, don't send a socks reply back */ edge_conn->socks_request->has_finished = 1; } + connection_close_immediate(conn); /* Don't flush; connection is dead. */ connection_mark_for_close(conn); return -1; } @@ -2145,14 +2156,11 @@ connection_handle_write(connection_t *conn, int force) log_info(LD_NET,"in-progress connect failed. Removing."); 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_close_immediate(conn); connection_mark_for_close(conn); - /* it's safe to pass OPs to router_set_status(), since it just - * ignores unrecognized routers - */ - if (conn->type == CONN_TYPE_OR && !get_options()->HttpsProxy) - router_set_status(TO_OR_CONN(conn)->identity_digest, 0); return -1; } else { return 0; /* no change, see if next time is better */ |