[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r12023: Better log messages about extrainfo downloads. (in tor/trunk: . src/or)
Author: nickm
Date: 2007-10-18 10:50:59 -0400 (Thu, 18 Oct 2007)
New Revision: 12023
Modified:
tor/trunk/
tor/trunk/src/or/directory.c
tor/trunk/src/or/networkstatus.c
tor/trunk/src/or/routerlist.c
Log:
r15917@catbus: nickm | 2007-10-18 10:50:01 -0400
Better log messages about extrainfo downloads.
Property changes on: tor/trunk
___________________________________________________________________
svk:merge ticket from /tor/trunk [r15917] on 8246c3cf-6607-4228-993b-4d95d33730f1
Modified: tor/trunk/src/or/directory.c
===================================================================
--- tor/trunk/src/or/directory.c 2007-10-18 14:27:42 UTC (rev 12022)
+++ tor/trunk/src/or/directory.c 2007-10-18 14:50:59 UTC (rev 12023)
@@ -1560,8 +1560,9 @@
}
}
if (which) { /* mark remaining ones as failed */
- log_info(LD_DIR, "Received %d/%d routers requested from %s:%d",
+ log_info(LD_DIR, "Received %d/%d %s requested from %s:%d",
n_asked_for-smartlist_len(which), n_asked_for,
+ was_ei ? "extra-info documents" : "router descriptors",
conn->_base.address, (int)conn->_base.port);
if (smartlist_len(which)) {
dir_routerdesc_download_failed(which, status_code,
Modified: tor/trunk/src/or/networkstatus.c
===================================================================
--- tor/trunk/src/or/networkstatus.c 2007-10-18 14:27:42 UTC (rev 12022)
+++ tor/trunk/src/or/networkstatus.c 2007-10-18 14:50:59 UTC (rev 12023)
@@ -780,9 +780,16 @@
tor_assert(start+dl_interval < c->valid_until);
time_to_download_next_consensus = start + crypto_rand_int(dl_interval);
{
- char tbuf[ISO_TIME_LEN+1];
- format_local_iso_time(tbuf, time_to_download_next_consensus);
- log_info(LD_DIR, "Have a live consensus; fetching next one at %s.",tbuf);
+ char tbuf1[ISO_TIME_LEN+1];
+ char tbuf2[ISO_TIME_LEN+1];
+ char tbuf3[ISO_TIME_LEN+1];
+ format_local_iso_time(tbuf1, c->fresh_until);
+ format_local_iso_time(tbuf2, c->valid_until);
+ format_local_iso_time(tbuf3, time_to_download_next_consensus);
+ log_info(LD_DIR, "Live consensus %s the most recent until %s and will "
+ "expire at %s; fetching the next one at %s.",
+ (c->fresh_until > now) ? "will be" : "was",
+ tbuf1, tbuf2, tbuf3);
}
} else {
time_to_download_next_consensus = now;
Modified: tor/trunk/src/or/routerlist.c
===================================================================
--- tor/trunk/src/or/routerlist.c 2007-10-18 14:27:42 UTC (rev 12022)
+++ tor/trunk/src/or/routerlist.c 2007-10-18 14:50:59 UTC (rev 12023)
@@ -3771,24 +3771,6 @@
update_consensus_router_descriptor_downloads(now);
}
-/** Return true iff <b>sd</b> is the descriptor for a router descriptor that
- * has an extrainfo that we don't currently have, are not currently
- * downloading, and have not recently tried to download. */
-static INLINE int
-should_download_extrainfo(signed_descriptor_t *sd,
- const routerlist_t *rl,
- const digestmap_t *pending,
- time_t now)
-{
- const char *d = sd->extra_info_digest;
- return (!sd->is_extrainfo &&
- !tor_digest_is_zero(d) &&
- download_status_is_ready(&sd->ei_dl_status, now,
- MAX_ROUTERDESC_DOWNLOAD_FAILURES) &&
- !eimap_get(rl->extra_info_map, d) &&
- !digestmap_get(pending, d));
-}
-
/** Launch extrainfo downloads as needed. */
void
update_extrainfo_downloads(time_t now)
@@ -3797,7 +3779,8 @@
routerlist_t *rl;
smartlist_t *wanted;
digestmap_t *pending;
- int i;
+ int old_routers, i;
+ int n_no_ei = 0, n_pending = 0, n_have = 0, n_delay = 0;
if (! options->DownloadExtraInfo)
return;
if (should_delay_dir_fetches(options))
@@ -3807,20 +3790,44 @@
list_pending_descriptor_downloads(pending, 1);
rl = router_get_routerlist();
wanted = smartlist_create();
- SMARTLIST_FOREACH(rl->routers, routerinfo_t *, ri, {
- if (should_download_extrainfo(&ri->cache_info, rl, pending, now)) {
- smartlist_add(wanted, ri->cache_info.extra_info_digest);
+ for (old_routers = 0; old_routers < 2; ++old_routers) {
+ smartlist_t *lst = old_routers ? rl->old_routers : rl->routers;
+ for (i = 0; i < smartlist_len(lst); ++i) {
+ signed_descriptor_t *sd;
+ char *d;
+ if (old_routers)
+ sd = smartlist_get(lst, i);
+ else
+ sd = &((routerinfo_t*)smartlist_get(lst, i))->cache_info;
+ if (sd->is_extrainfo)
+ continue; /* This should never happen. */
+ d = sd->extra_info_digest;
+ if (tor_digest_is_zero(d)) {
+ ++n_no_ei;
+ continue;
}
- });
- if (dirserver_mode(options)) {
- SMARTLIST_FOREACH(rl->old_routers, signed_descriptor_t *, sd, {
- if (should_download_extrainfo(sd, rl, pending, now)) {
- smartlist_add(wanted, sd->extra_info_digest);
- }
- });
+ if (eimap_get(rl->extra_info_map, d)) {
+ ++n_have;
+ continue;
+ }
+ if (!download_status_is_ready(&sd->ei_dl_status, now,
+ MAX_ROUTERDESC_DOWNLOAD_FAILURES)) {
+ ++n_delay;
+ continue;
+ }
+ if (digestmap_get(pending, d)) {
+ ++n_pending;
+ continue;
+ }
+ smartlist_add(wanted, d);
+ }
}
digestmap_free(pending, NULL);
+ log_info(LD_DIR, "Extrainfo download status: %d router with no ei, %d "
+ "with present ei, %d delaying, %d pending, %d downloadable.",
+ n_no_ei, n_have, n_delay, n_pending, smartlist_len(wanted));
+
smartlist_shuffle(wanted);
for (i = 0; i < smartlist_len(wanted); i += MAX_DL_PER_REQUEST) {
initiate_descriptor_downloads(NULL, DIR_PURPOSE_FETCH_EXTRAINFO,