[or-cvs] [tor/master 1/2] weight guard choice by bandwidth; discard old guards
arma at torproject.org
arma at torproject.org
Tue Jan 19 22:54:58 UTC 2010
Author: Roger Dingledine <arma at torproject.org>
Date: Tue, 19 Jan 2010 17:30:52 -0500
Subject: weight guard choice by bandwidth; discard old guards
Commit: 0642ab242865c00816510934ea1c3f6ce6982db9
---
ChangeLog | 11 +++++++++++
src/or/circuitbuild.c | 29 ++++++++++++++++++++---------
2 files changed, 31 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index a783590..998d14c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Changes in version 0.2.1.23 - 2010-0?-??
+ o Major bugfixes (performance):
+ - We were selecting our guards uniformly at random, and then weighting
+ which of our guards we'd use uniformly at random. This imbalance
+ meant that Tor clients were severely limited on throughput (and
+ probably latency too) by the first hop in their circuit. Now we
+ select guards weighted by currently advertised bandwidth. We also
+ automatically discard guards picked using the old algorithm. Fixes
+ bug 1217; bugfix on 0.2.1.3-alpha. Found by Mike Perry.
+
+
Changes in version 0.2.1.22 - 2010-01-19
Tor 0.2.1.22 fixes a critical privacy problem in bridge directory
authorities -- it would tell you its whole history of bridge descriptors
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 4b5ba62..1f4a493 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -1697,7 +1697,7 @@ choose_good_entry_server(uint8_t purpose, cpath_build_state_t *state)
routerinfo_t *r, *choice;
smartlist_t *excluded;
or_options_t *options = get_options();
- router_crn_flags_t flags = 0;
+ router_crn_flags_t flags = CRN_NEED_GUARD;
if (state && options->UseEntryGuards &&
(purpose != CIRCUIT_PURPOSE_TESTING || options->BridgeRelay)) {
@@ -1734,7 +1734,6 @@ choose_good_entry_server(uint8_t purpose, cpath_build_state_t *state)
}
if (state) {
- flags |= CRN_NEED_GUARD;
if (state->need_uptime)
flags |= CRN_NEED_UPTIME;
if (state->need_capacity)
@@ -2203,13 +2202,25 @@ remove_obsolete_entry_guards(void)
} else if (tor_version_parse(ver, &v)) {
msg = "does not seem to be from any recognized version of Tor";
version_is_bad = 1;
- } else if ((tor_version_as_new_as(ver, "0.1.0.10-alpha") &&
- !tor_version_as_new_as(ver, "0.1.2.16-dev")) ||
- (tor_version_as_new_as(ver, "0.2.0.0-alpha") &&
- !tor_version_as_new_as(ver, "0.2.0.6-alpha"))) {
- msg = "was selected without regard for guard bandwidth";
- version_is_bad = 1;
- } else if (entry->chosen_on_date + 3600*24*35 < this_month) {
+ } else {
+ size_t len = strlen(ver)+5;
+ char *tor_ver = tor_malloc(len);
+ tor_snprintf(tor_ver, len, "Tor %s", ver);
+ if ((tor_version_as_new_as(tor_ver, "0.1.0.10-alpha") &&
+ !tor_version_as_new_as(tor_ver, "0.1.2.16-dev")) ||
+ (tor_version_as_new_as(tor_ver, "0.2.0.0-alpha") &&
+ !tor_version_as_new_as(tor_ver, "0.2.0.6-alpha")) ||
+ /* above are bug 440; below are bug 1217 */
+ (tor_version_as_new_as(tor_ver, "0.2.1.3-alpha") &&
+ !tor_version_as_new_as(tor_ver, "0.2.1.23")) ||
+ (tor_version_as_new_as(tor_ver, "0.2.2.0-alpha") &&
+ !tor_version_as_new_as(tor_ver, "0.2.2.7-alpha"))) {
+ msg = "was selected without regard for guard bandwidth";
+ version_is_bad = 1;
+ }
+ tor_free(tor_ver);
+ }
+ if (!version_is_bad && entry->chosen_on_date + 3600*24*35 < this_month) {
/* It's been more than a month, and probably more like two since
* chosen_on_date is clipped to the beginning of its month. */
msg = "was selected several months ago";
--
1.6.5
More information about the tor-commits
mailing list