summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2009-04-11 12:00:18 +0000
committerRoger Dingledine <arma@torproject.org>2009-04-11 12:00:18 +0000
commit48118b228e5c3d361a5cfdfa614b1a923da0a854 (patch)
treee00f66e65a17c98c53563ceae6eb8d39df87c301
parentebadf2b068903d75e41322acb9eb00d47338804a (diff)
downloadtor-48118b228e5c3d361a5cfdfa614b1a923da0a854.tar.gz
tor-48118b228e5c3d361a5cfdfa614b1a923da0a854.zip
Clients replace entry guards that were chosen more than a few months
ago. This change should significantly improve client performance, especially once more people upgrade, since relays that have been a guard for a long time are currently overloaded. svn:r19287
-rw-r--r--ChangeLog14
-rw-r--r--src/or/circuitbuild.c18
2 files changed, 21 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 55b691f17d..8a008d3fa5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,12 +3,18 @@ Changes in version 0.2.1.14-rc - 2009-04-11
- Avoid crashing in the presence of certain malformed descriptors.
Found by lark, and by automated fuzzing.
+ o Major features:
+ - Clients replace entry guards that were chosen more than a few months
+ ago. This change should significantly improve client performance,
+ especially once more people upgrade, since relays that have been
+ a guard for a long time are currently overloaded.
+
o Major bugfixes:
- Relays were falling out of the networkstatus consensus for
- half a day if they changed their local config but the authorities
- discarded their new descriptor as "not sufficiently different". Now
- directory authorities accept a descriptor as changed if
- bandwidthrate or bandwidthburst changed. Partial fix for bug 962;
+ part of a day if they changed their local config but the
+ authorities discarded their new descriptor as "not sufficiently
+ different". Now directory authorities accept a descriptor as changed
+ if bandwidthrate or bandwidthburst changed. Partial fix for bug 962;
patch by Sebastian.
o Minor features:
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 9e2f826c42..64196b07a9 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -2135,28 +2135,30 @@ static int
remove_obsolete_entry_guards(void)
{
int changed = 0, i;
+ time_t this_month = start_of_month(time(NULL));
+
for (i = 0; i < smartlist_len(entry_guards); ++i) {
entry_guard_t *entry = smartlist_get(entry_guards, i);
const char *ver = entry->chosen_by_version;
const char *msg = NULL;
tor_version_t v;
- int version_is_bad = 0;
if (!ver) {
msg = "does not say what version of Tor it was selected by";
- version_is_bad = 1;
} 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) {
+ /* 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";
}
- if (version_is_bad) {
+
+ if (msg) { /* we need to drop it */
char dbuf[HEX_DIGEST_LEN+1];
- tor_assert(msg);
base16_encode(dbuf, sizeof(dbuf), entry->identity, DIGEST_LEN);
log_notice(LD_CIRC, "Entry guard '%s' (%s) %s. (Version=%s.) "
"Replacing it.",
@@ -2730,7 +2732,7 @@ entry_guards_parse_state(or_state_t *state, int set, char **msg)
SMARTLIST_FOREACH(new_entry_guards, entry_guard_t *, e,
entry_guard_free(e));
smartlist_free(new_entry_guards);
- } else { /* !*err && set */
+ } else { /* !err && set */
if (entry_guards) {
SMARTLIST_FOREACH(entry_guards, entry_guard_t *, e,
entry_guard_free(e));
@@ -2738,6 +2740,8 @@ entry_guards_parse_state(or_state_t *state, int set, char **msg)
}
entry_guards = new_entry_guards;
entry_guards_dirty = 0;
+ /* XXX022 hand new_entry_guards to this func, and move it up a
+ * few lines, so we don't have to re-dirty it */
if (remove_obsolete_entry_guards())
entry_guards_dirty = 1;
}