summaryrefslogtreecommitdiff
path: root/src/or/circuituse.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2010-09-28 22:32:38 -0400
committerRoger Dingledine <arma@torproject.org>2010-09-28 22:32:38 -0400
commit9997676802c140aceddb849090c7b3795fc83361 (patch)
tree66cdff441b840e2405f146bc6b32a37cce35849a /src/or/circuituse.c
parent7de1caa33f025db5474dba5f7e256d28c5ab4969 (diff)
downloadtor-9997676802c140aceddb849090c7b3795fc83361.tar.gz
tor-9997676802c140aceddb849090c7b3795fc83361.zip
handle ugly edge case in retrying entrynodes
Specifically, a circ attempt that we'd launched while the network was down could timeout after we've marked our entrynodes up, marking them back down again. The fix is to annotate as bad the OR conns that were around before we did the retry, so if a circuit that's attached to them times out we don't do anything about it.
Diffstat (limited to 'src/or/circuituse.c')
-rw-r--r--src/or/circuituse.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/or/circuituse.c b/src/or/circuituse.c
index ee1705b4c9..f651ef7c33 100644
--- a/src/or/circuituse.c
+++ b/src/or/circuituse.c
@@ -955,8 +955,15 @@ circuit_build_failed(origin_circuit_t *circ)
* to blame, blame it. Also, avoid this relay for a while, and
* fail any one-hop directory fetches destined for it. */
const char *n_conn_id = circ->cpath->extend_info->identity_digest;
+ int already_marked = 0;
if (circ->_base.n_conn) {
or_connection_t *n_conn = circ->_base.n_conn;
+ if (n_conn->is_bad_for_new_circs) {
+ /* no need to blow away circuits/streams/etc. Also, don't mark this
+ * router as newly down, since maybe this was just an old circuit
+ * attempt that's finally timing out now. */
+ already_marked = 1;
+ }
log_info(LD_OR,
"Our circuit failed to get a response from the first hop "
"(%s:%d). I'm going to try to rotate to a better connection.",
@@ -966,7 +973,7 @@ circuit_build_failed(origin_circuit_t *circ)
log_info(LD_OR,
"Our circuit died before the first hop with no connection");
}
- if (n_conn_id) {
+ if (n_conn_id && !already_marked) {
entry_guard_register_connect_status(n_conn_id, 0, 1, time(NULL));
/* if there are any one-hop streams waiting on this circuit, fail
* them now so they can retry elsewhere. */