summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2007-02-24 21:21:38 +0000
committerRoger Dingledine <arma@torproject.org>2007-02-24 21:21:38 +0000
commitd6c21ab8a732d61a3441b24fd8c062c3c6b38ee9 (patch)
treeac8b9aaf6d67eeb9ec370aab65ad20bd10c4cbc0
parentbf1b4df2b60da13aac9317f5758b76ef70de7c68 (diff)
downloadtor-d6c21ab8a732d61a3441b24fd8c062c3c6b38ee9.tar.gz
tor-d6c21ab8a732d61a3441b24fd8c062c3c6b38ee9.zip
tell the user if we're delaying his newnym request. also, pick
a different set of fenceposts. svn:r9647
-rw-r--r--src/or/directory.c8
-rw-r--r--src/or/main.c11
-rw-r--r--src/or/routerlist.c2
3 files changed, 14 insertions, 7 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index b7a5535ca3..0dc2eccf0d 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -352,8 +352,8 @@ connection_dir_download_routerdesc_failed(dir_connection_t *conn)
/* No need to increment the failure count for routerdescs, since
* it's not their fault. */
- /* There's no relaunch descriptor downloads here: we already do it every 10
- * seconds (DESCRIPTOR_RETRY_INTERVAL) in main.c */
+ /* No need to relaunch descriptor downloads here: we already do it
+ * every 10 seconds (DESCRIPTOR_RETRY_INTERVAL) in main.c. */
(void) conn;
}
@@ -2057,8 +2057,8 @@ dir_routerdesc_download_failed(smartlist_t *failed, int status_code)
cp, (int)rs->n_download_failures);
});
- /* There's no relaunch descriptor downloads here: we already do it every 10
- * seconds (DESCRIPTOR_RETRY_INTERVAL) in main.c */
+ /* No need to relaunch descriptor downloads here: we already do it
+ * every 10 seconds (DESCRIPTOR_RETRY_INTERVAL) in main.c. */
}
/** Given a directory <b>resource</b> request, containing zero
diff --git a/src/or/main.c b/src/or/main.c
index c5b7d13625..551b3686b2 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -756,7 +756,8 @@ run_scheduled_events(time_t now)
/* 0b. If we've deferred a signewnym, make sure it gets handled
* eventually */
if (signewnym_is_pending &&
- time_of_last_signewnym + MAX_SIGNEWNYM_RATE < now) {
+ time_of_last_signewnym + MAX_SIGNEWNYM_RATE <= now) {
+ log(LOG_INFO, LD_CONTROL, "Honoring delayed NEWNYM request");
circuit_expire_all_dirty_circs();
addressmap_clear_transient();
time_of_last_signewnym = now;
@@ -1389,9 +1390,15 @@ signal_callback(int fd, short events, void *arg)
#endif
case SIGNEWNYM: {
time_t now = time(NULL);
- if (time_of_last_signewnym + MAX_SIGNEWNYM_RATE >= now) {
+ if (time_of_last_signewnym + MAX_SIGNEWNYM_RATE > now) {
signewnym_is_pending = 1;
+ log(LOG_NOTICE, LD_CONTROL,
+ "Rate limiting NEWNYM request: delaying by %d second(s)",
+ (int)(MAX_SIGNEWNYM_RATE+time_of_last_signewnym-now));
} else {
+ /* XXX refactor someday: these two calls are in
+ * run_scheduled_events() above too, and they should be in just
+ * one place. */
circuit_expire_all_dirty_circs();
addressmap_clear_transient();
time_of_last_signewnym = now;
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index 1408b77502..ef14d21736 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -1911,7 +1911,7 @@ router_add_to_routerlist(routerinfo_t *router, const char **msg,
if (!signed_desc_digest_is_recognized(&router->cache_info)) {
/* We asked for it, so some networkstatus must have listed it when we
- * did. save it in case we're a cache and somebody else asks for it. */
+ * did. Save it if we're a cache in case somebody else asks for it. */
log_info(LD_DIR,
"Received a no-longer-recognized descriptor for router '%s'",
router->nickname);