summaryrefslogtreecommitdiff
path: root/src/or/entrynodes.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2015-04-23 09:10:35 -0400
committerNick Mathewson <nickm@torproject.org>2015-04-23 09:10:35 -0400
commit647b7d37c2b3de4a837d0a4bf810c0132624c15d (patch)
treed2619889049cdd30f62ddebffb96cf62835cb6e5 /src/or/entrynodes.c
parent3acee6142221839137607c9a9cbf8ca4feea5993 (diff)
parente48ad353a31f3ee376f7914563d960916ad6aecd (diff)
downloadtor-647b7d37c2b3de4a837d0a4bf810c0132624c15d.tar.gz
tor-647b7d37c2b3de4a837d0a4bf810c0132624c15d.zip
Merge remote-tracking branch 'public/bug15745_027_03'
Diffstat (limited to 'src/or/entrynodes.c')
-rw-r--r--src/or/entrynodes.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/or/entrynodes.c b/src/or/entrynodes.c
index 9663f34002..9f07d5ad69 100644
--- a/src/or/entrynodes.c
+++ b/src/or/entrynodes.c
@@ -440,7 +440,8 @@ add_an_entry_guard(const node_t *chosen, int reset_status, int prepend,
* don't all select them on the same day, and b) avoid leaving a
* precise timestamp in the state file about when we first picked
* this guard. For details, see the Jan 2010 or-dev thread. */
- entry->chosen_on_date = time(NULL) - crypto_rand_int(3600*24*30);
+ time_t now = time(NULL);
+ entry->chosen_on_date = crypto_rand_int_range(now - 3600*24*30, now);
entry->chosen_by_version = tor_strdup(VERSION);
/* Are we picking this guard because all of our current guards are
@@ -1439,8 +1440,9 @@ entry_guards_parse_state(or_state_t *state, int set, char **msg)
}
} else {
if (state_version) {
+ time_t now = time(NULL);
+ e->chosen_on_date = crypto_rand_int_range(now - 3600*24*30, now);
e->chosen_by_version = tor_strdup(state_version);
- e->chosen_on_date = time(NULL) - crypto_rand_int(3600*24*30);
}
}
if (e->path_bias_disabled && !e->bad_since)