diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-12-17 14:59:19 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-12-17 14:59:19 +0000 |
commit | 26632d59dd34aef4834ee9844adeab5131248bf7 (patch) | |
tree | 694c0654f8ae8194c1f2b5ce490990aa5f101821 /src/or | |
parent | 514f99034fffcbfe6cd37d2b982c6c637e62f37e (diff) | |
download | tor-26632d59dd34aef4834ee9844adeab5131248bf7.tar.gz tor-26632d59dd34aef4834ee9844adeab5131248bf7.zip |
Rename or_is_obsolete and move it to or_connection_t where it belongs.
svn:r17642
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/circuitbuild.c | 2 | ||||
-rw-r--r-- | src/or/circuituse.c | 2 | ||||
-rw-r--r-- | src/or/connection_or.c | 4 | ||||
-rw-r--r-- | src/or/main.c | 23 | ||||
-rw-r--r-- | src/or/or.h | 8 |
5 files changed, 20 insertions, 19 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index c561ac7e6f..521d347360 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -358,7 +358,7 @@ connection_good_enough_for_extend(const or_connection_t *n_conn, *state_out = "in progress. Waiting."; *launch_out = 0; /* We'll just wait till the connection finishes. */ return 0; - } else if (n_conn->_base.or_is_obsolete) { + } else if (n_conn->is_bad_for_new_circs) { *state_out = "too old. Launching a new one."; *launch_out = 1; return 0; diff --git a/src/or/circuituse.c b/src/or/circuituse.c index ed544715e9..966af11ab6 100644 --- a/src/or/circuituse.c +++ b/src/or/circuituse.c @@ -820,7 +820,7 @@ circuit_build_failed(origin_circuit_t *circ) "Our circuit failed to get a response from the first hop " "(%s:%d). I'm going to try to rotate to a better connection.", n_conn->_base.address, n_conn->_base.port); - n_conn->_base.or_is_obsolete = 1; + n_conn->is_bad_for_new_circs = 1; entry_guard_register_connect_status(n_conn->identity_digest, 0, time(NULL)); } diff --git a/src/or/connection_or.c b/src/or/connection_or.c index 028f3ded79..2cd96688f2 100644 --- a/src/or/connection_or.c +++ b/src/or/connection_or.c @@ -474,14 +474,14 @@ connection_or_get_by_identity_digest(const char *digest) if (best->is_canonical && !conn->is_canonical) continue; /* A canonical connection is best. */ - if (!best->_base.or_is_obsolete && conn->_base.or_is_obsolete) + if (!best->is_bad_for_new_circs && conn->is_bad_for_new_circs) continue; /* We never prefer obsolete over non-obsolete connections. */ if ( /* We prefer canonical connections: */ (!best->is_canonical && conn->is_canonical) || /* We prefer non-obsolete connections: */ - (best->_base.or_is_obsolete && !conn->_base.or_is_obsolete) || + (best->is_bad_for_new_circs && !conn->is_bad_for_new_circs) || /* If both have circuits we prefer the newer: */ (best->n_circuits && conn->n_circuits && newer) || /* If neither has circuits we prefer the newer: */ diff --git a/src/or/main.c b/src/or/main.c index a6411d5b0a..b2074e2105 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -99,8 +99,8 @@ int has_completed_circuit=0; #define DIR_CONN_MAX_STALL (5*60) /** How old do we let a connection to an OR get before deciding it's - * obsolete? */ -#define TIME_BEFORE_OR_CONN_IS_OBSOLETE (60*60*24*7) + * too old for new circuits? */ +#define TIME_BEFORE_OR_CONN_IS_TOO_OLD (60*60*24*7) /** How long do we let OR connections handshake before we decide that * they are obsolete? */ #define TLS_HANDSHAKE_TIMEOUT (60) @@ -714,13 +714,14 @@ run_connection_housekeeping(int i, time_t now) or_conn = TO_OR_CONN(conn); - if (!conn->or_is_obsolete) { - if (conn->timestamp_created + TIME_BEFORE_OR_CONN_IS_OBSOLETE < now) { + if (!or_conn->is_bad_for_new_circs) { + if (conn->timestamp_created + TIME_BEFORE_OR_CONN_IS_TOO_OLD < now) { log_info(LD_OR, - "Marking OR conn to %s:%d obsolete (fd %d, %d secs old).", + "Marking OR conn to %s:%d as too old for new circuits " + "(fd %d, %d secs old).", conn->address, conn->port, conn->s, (int)(now - conn->timestamp_created)); - conn->or_is_obsolete = 1; + or_conn->is_bad_for_new_circs = 1; } else { or_connection_t *best = connection_or_get_by_identity_digest(or_conn->identity_digest); @@ -735,19 +736,19 @@ run_connection_housekeeping(int i, time_t now) * early for router->last_reachable to be updated. */ log_info(LD_OR, - "Marking duplicate conn to %s:%d obsolete " + "Marking duplicate conn to %s:%d as too old for new circuits " "(fd %d, %d secs old).", conn->address, conn->port, conn->s, (int)(now - conn->timestamp_created)); - conn->or_is_obsolete = 1; + or_conn->is_bad_for_new_circs = 1; } } } - if (conn->or_is_obsolete && !or_conn->n_circuits) { + if (or_conn->is_bad_for_new_circs && !or_conn->n_circuits) { /* no unmarked circs -- mark it now */ log_info(LD_OR, - "Expiring non-used OR connection to fd %d (%s:%d) [Obsolete].", + "Expiring non-used OR connection to fd %d (%s:%d) [Too old].", conn->s, conn->address, conn->port); if (conn->state == OR_CONN_STATE_CONNECTING) connection_or_connect_failed(TO_OR_CONN(conn), @@ -905,7 +906,7 @@ run_scheduled_events(time_t now) } last_rotated_x509_certificate = now; /* We also make sure to rotate the TLS connections themselves if they've - * been up for too long -- but that's done via or_is_obsolete in + * been up for too long -- but that's done via is_bad_for_new_circs in * connection_run_housekeeping() above. */ } diff --git a/src/or/or.h b/src/or/or.h index eb83d477a3..8e56ac249d 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -904,10 +904,6 @@ typedef struct connection_t { /** Edge connections only: true if we've blocked reading until the * circuit has fewer queued cells. */ unsigned int edge_blocked_on_circ:1; - /** Used for OR conns that shouldn't get any new circs attached to them, - * because the connection is too old. */ - /* XXXX "obsolete" isn't really a good name here. */ - unsigned int or_is_obsolete:1; /** For AP connections only. If 1, and we fail to reach the chosen exit, * stop requiring it. */ unsigned int chosen_exit_optional:1; @@ -1020,6 +1016,10 @@ typedef struct or_connection_t { * address listed in a server descriptor, or because an authenticated * NETINFO cell listed the address we're connected to as recognized. */ unsigned int is_canonical:1; + /** True iff this connection shouldn't get any new circs attached to it, + * because the connection is too old, or because there's a better one, etc. + */ + unsigned int is_bad_for_new_circs:1; uint8_t link_proto; /**< What protocol version are we using? 0 for * "none negotiated yet." */ circid_t next_circ_id; /**< Which circ_id do we try to use next on |