mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 05:03:43 +01:00
r14631@tombo: nickm | 2007-11-02 00:18:17 -0400
Better log messages for "not enough to build a circuit" message. svn:r12324
This commit is contained in:
parent
dddff3acf9
commit
6aeca5237d
@ -44,6 +44,7 @@ Changes in version 0.2.0.10-alpha - 2007-1?-??
|
||||
- Authorities send back an X-Descriptor-Not-New header in response to
|
||||
an accepted-but-discarded descriptor upload. Partially implements
|
||||
fix for bug 535.
|
||||
- Make the "not enough dir info yet" message better.
|
||||
|
||||
o Minor features (controller):
|
||||
- When reporting clock skew, and we only have a lower bound on the amount
|
||||
|
@ -659,7 +659,7 @@ directory_info_has_arrived(time_t now, int from_cache)
|
||||
if (!router_have_minimum_dir_info()) {
|
||||
log(LOG_NOTICE, LD_DIR,
|
||||
"I learned some more directory information, but not enough to "
|
||||
"build a circuit.");
|
||||
"build a circuit: %s", get_dir_info_status_string());
|
||||
update_router_descriptor_downloads(now);
|
||||
return;
|
||||
} else {
|
||||
|
@ -3769,6 +3769,7 @@ void update_router_descriptor_downloads(time_t now);
|
||||
void update_extrainfo_downloads(time_t now);
|
||||
int router_have_minimum_dir_info(void);
|
||||
void router_dir_info_changed(void);
|
||||
const char *get_dir_info_status_string(void);
|
||||
void router_reset_descriptor_download_failures(void);
|
||||
int router_differences_are_cosmetic(routerinfo_t *r1, routerinfo_t *r2);
|
||||
int routerinfo_incompatible_with_extrainfo(routerinfo_t *ri, extrainfo_t *ei,
|
||||
|
@ -3845,6 +3845,8 @@ static int have_min_dir_info = 0;
|
||||
* enough directory info to build circuits that our old answer can no longer
|
||||
* be trusted. */
|
||||
static int need_to_update_have_min_dir_info = 1;
|
||||
/** DOCDOC */
|
||||
static char dir_info_status[128] = "";
|
||||
|
||||
/** Return true iff we have enough networkstatus and router information to
|
||||
* start building circuits. Right now, this means "more than half the
|
||||
@ -3870,6 +3872,13 @@ router_dir_info_changed(void)
|
||||
need_to_update_have_min_dir_info = 1;
|
||||
}
|
||||
|
||||
/** DOCDOC */
|
||||
const char *
|
||||
get_dir_info_status_string(void)
|
||||
{
|
||||
return dir_info_status;
|
||||
}
|
||||
|
||||
/** Change the value of have_min_dir_info, setting it true iff we have enough
|
||||
* network and router information to build circuits. Clear the value of
|
||||
* need_to_update_have_min_dir_info. */
|
||||
@ -3884,12 +3893,19 @@ update_router_have_minimum_dir_info(void)
|
||||
networkstatus_get_reasonably_live_consensus(now);
|
||||
|
||||
if (!consensus) {
|
||||
if (!networkstatus_get_latest_consensus())
|
||||
strlcpy(dir_info_status, "We have no network-status document.",
|
||||
sizeof(dir_info_status));
|
||||
else
|
||||
strlcpy(dir_info_status, "We have no recent network-status document.",
|
||||
sizeof(dir_info_status));
|
||||
res = 0;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (should_delay_dir_fetches(get_options())) {
|
||||
log_notice(LD_DIR, "no known bridge descriptors running yet; stalling");
|
||||
strlcpy(dir_info_status, "No bridge descriptors.", sizeof(dir_info_status));
|
||||
res = 0;
|
||||
goto done;
|
||||
}
|
||||
@ -3903,7 +3919,19 @@ update_router_have_minimum_dir_info(void)
|
||||
}
|
||||
}
|
||||
});
|
||||
res = num_present >= num_usable/4 && num_usable > 2;
|
||||
|
||||
if (num_present < num_usable/4) {
|
||||
tor_snprintf(dir_info_status, sizeof(dir_info_status),
|
||||
"We have only %d/%d usable descriptors.", num_present, num_usable);
|
||||
res = 0;
|
||||
} else if (num_usable < 2) {
|
||||
tor_snprintf(dir_info_status, sizeof(dir_info_status),
|
||||
"Only %d usable descriptor%s known!", num_usable,
|
||||
num_usable ? "" : "s");
|
||||
res = 0;
|
||||
} else {
|
||||
res = 1;
|
||||
}
|
||||
|
||||
done:
|
||||
if (res && !have_min_dir_info) {
|
||||
@ -3919,6 +3947,7 @@ update_router_have_minimum_dir_info(void)
|
||||
control_event_client_status(LOG_NOTICE, "NOT_ENOUGH_DIR_INFO");
|
||||
}
|
||||
have_min_dir_info = res;
|
||||
need_to_update_have_min_dir_info = 0;
|
||||
}
|
||||
|
||||
/** Reset the descriptor download failure count on all routers, so that we
|
||||
|
Loading…
Reference in New Issue
Block a user