From 9997676802c140aceddb849090c7b3795fc83361 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Tue, 28 Sep 2010 22:32:38 -0400 Subject: 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. --- src/or/circuituse.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/or/circuituse.c') 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. */ -- cgit v1.2.3-54-g00ecf