Merge remote-tracking branch 'origin/maint-0.2.5'

This commit is contained in:
Nick Mathewson 2014-08-08 10:09:17 -04:00
commit bb68c731b8
4 changed files with 22 additions and 12 deletions

7
changes/bug11200-caching Normal file
View File

@ -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.

View File

@ -349,7 +349,7 @@ should_use_directory_guards(const or_options_t *options)
return 1; 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 * networkstatus, or the fallback dirservers, for use in downloading
* information of type <b>type</b>, and return its routerstatus. */ * information of type <b>type</b>, and return its routerstatus. */
static const routerstatus_t * static const routerstatus_t *

View File

@ -1275,10 +1275,21 @@ static char dir_info_status[256] = "";
int int
router_have_minimum_dir_info(void) 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)) { if (PREDICT_UNLIKELY(need_to_update_have_min_dir_info)) {
update_router_have_minimum_dir_info(); update_router_have_minimum_dir_info();
need_to_update_have_min_dir_info = 0;
} }
return have_min_dir_info; return have_min_dir_info;
} }
@ -1498,7 +1509,6 @@ update_router_have_minimum_dir_info(void)
const networkstatus_t *consensus = const networkstatus_t *consensus =
networkstatus_get_reasonably_live_consensus(now,usable_consensus_flavor()); networkstatus_get_reasonably_live_consensus(now,usable_consensus_flavor());
int using_md; int using_md;
const char *delay_fetches_msg = NULL;
if (!consensus) { if (!consensus) {
if (!networkstatus_get_latest_consensus()) if (!networkstatus_get_latest_consensus())
@ -1511,13 +1521,6 @@ update_router_have_minimum_dir_info(void)
goto done; 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; using_md = consensus->flavor == FLAV_MICRODESC;
{ {

View File

@ -1367,7 +1367,7 @@ router_pick_trusteddirserver(dirinfo_type_t type, int flags)
return router_pick_dirserver_generic(trusted_dir_servers, type, 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. * router_pick_directory_server.
*/ */
const routerstatus_t * const routerstatus_t *
@ -1376,7 +1376,7 @@ router_pick_fallback_dirserver(dirinfo_type_t type, int flags)
return router_pick_dirserver_generic(fallback_dir_servers, type, 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. * router_pick_directory_server.
*/ */
static const routerstatus_t * static const routerstatus_t *