mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Rename or_is_obsolete and move it to or_connection_t where it belongs.
svn:r17642
This commit is contained in:
@@ -64,6 +64,10 @@ Changes in version 0.2.1.9-alpha - 200?-??-??
|
||||
points thrown away; bugfix on 0.2.1.7-alpha. Spotted by John Brooks.
|
||||
Patch by Karsten. Fixes bug 874.
|
||||
|
||||
o Code simplifications and refactoring:
|
||||
- Rename the confusing or_is_obsolete field to the more appropriate
|
||||
is_bad_for_new_circs, and move it to or_connection_t where it belongs.
|
||||
|
||||
|
||||
Changes in version 0.2.1.8-alpha - 2008-12-08
|
||||
Tor 0.2.1.8-alpha fixes some crash bugs in earlier alpha releases,
|
||||
|
||||
@@ -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;
|
||||
|
||||
+1
-1
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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: */
|
||||
|
||||
+12
-11
@@ -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. */
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user