From 0c869af7f8626cc74a7b82d0c0d6192cbb796d02 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Wed, 6 Aug 2014 02:20:51 -0400 Subject: [PATCH 1/2] fix three typos in comments --- src/or/directory.c | 2 +- src/or/routerlist.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/or/directory.c b/src/or/directory.c index 22ba056ee1..51ea312689 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -349,7 +349,7 @@ should_use_directory_guards(const or_options_t *options) return 1; } -/** Pick an unconsetrained directory server from among our guards, the latest +/** Pick an unconstrained directory server from among our guards, the latest * networkstatus, or the fallback dirservers, for use in downloading * information of type type, and return its routerstatus. */ static const routerstatus_t * diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 8f3477a4a4..b5e924522e 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -1365,7 +1365,7 @@ router_pick_trusteddirserver(dirinfo_type_t type, int flags) return router_pick_dirserver_generic(trusted_dir_servers, type, flags); } -/** Try to find a running fallback directory Flags are as for +/** Try to find a running fallback directory. Flags are as for * router_pick_directory_server. */ const routerstatus_t * @@ -1374,7 +1374,7 @@ router_pick_fallback_dirserver(dirinfo_type_t type, int flags) return router_pick_dirserver_generic(fallback_dir_servers, type, flags); } -/** Try to find a running fallback directory Flags are as for +/** Try to find a running fallback directory. Flags are as for * router_pick_directory_server. */ static const routerstatus_t * From fcac4b4467427e8f6ad948e8c8e6f34a0131e716 Mon Sep 17 00:00:00 2001 From: Roger Dingledine Date: Tue, 5 Aug 2014 16:54:46 -0400 Subject: [PATCH 2/2] Build circuits more readily when DisableNetwork goes to 0 When Tor starts with DisabledNetwork set, it would correctly conclude that it shouldn't try making circuits, but it would mistakenly cache this conclusion and continue believing it even when DisableNetwork is set to 0. Fixes the bug introduced by the fix for bug 11200; bugfix on 0.2.5.4-alpha. --- changes/bug11200-caching | 7 +++++++ src/or/nodelist.c | 21 ++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 changes/bug11200-caching diff --git a/changes/bug11200-caching b/changes/bug11200-caching new file mode 100644 index 0000000000..e3fbaeca73 --- /dev/null +++ b/changes/bug11200-caching @@ -0,0 +1,7 @@ + o Major bugfixes: + - When Tor starts with DisabledNetwork set, it would correctly + conclude that it shouldn't try making circuits, but it would + mistakenly cache this conclusion and continue believing it even + when DisableNetwork is set to 0. Fixes the bug introduced by the + fix for bug 11200; bugfix on 0.2.5.4-alpha. + diff --git a/src/or/nodelist.c b/src/or/nodelist.c index 8f870816d2..7b1f338bd4 100644 --- a/src/or/nodelist.c +++ b/src/or/nodelist.c @@ -1275,10 +1275,21 @@ static char dir_info_status[256] = ""; int router_have_minimum_dir_info(void) { + static int logged_delay=0; + const char *delay_fetches_msg = NULL; + if (should_delay_dir_fetches(get_options(), &delay_fetches_msg)) { + if (!logged_delay) + log_notice(LD_DIR, "Delaying directory fetches: %s", delay_fetches_msg); + logged_delay=1; + strlcpy(dir_info_status, delay_fetches_msg, sizeof(dir_info_status)); + return 0; + } + logged_delay = 0; /* reset it if we get this far */ + if (PREDICT_UNLIKELY(need_to_update_have_min_dir_info)) { update_router_have_minimum_dir_info(); - need_to_update_have_min_dir_info = 0; } + return have_min_dir_info; } @@ -1498,7 +1509,6 @@ update_router_have_minimum_dir_info(void) const networkstatus_t *consensus = networkstatus_get_reasonably_live_consensus(now,usable_consensus_flavor()); int using_md; - const char *delay_fetches_msg = NULL; if (!consensus) { if (!networkstatus_get_latest_consensus()) @@ -1511,13 +1521,6 @@ update_router_have_minimum_dir_info(void) goto done; } - if (should_delay_dir_fetches(get_options(), &delay_fetches_msg)) { - log_notice(LD_DIR, "Delaying directory fetches: %s", delay_fetches_msg); - strlcpy(dir_info_status, delay_fetches_msg, sizeof(dir_info_status)); - res = 0; - goto done; - } - using_md = consensus->flavor == FLAV_MICRODESC; {