even better, only print extend attempts if there are any.

svn:r2285
This commit is contained in:
Roger Dingledine 2004-08-18 09:57:50 +00:00
parent a447570036
commit 20b8819023

View File

@ -266,30 +266,29 @@ void rep_hist_dump_stats(time_t now, int severity)
or_history->n_conn_ok, or_history->n_conn_fail+or_history->n_conn_ok, or_history->n_conn_ok, or_history->n_conn_fail+or_history->n_conn_ok,
upt, upt+downt, uptime*100.0); upt, upt+downt, uptime*100.0);
if (!strmap_isempty(or_history->link_history_map)) if (!strmap_isempty(or_history->link_history_map)) {
strcpy(buffer, " Good extend attempts: "); strcpy(buffer, " Good extend attempts: ");
else len = strlen(buffer);
*buffer = '\0'; for (lhist_it = strmap_iter_init(or_history->link_history_map);
len = strlen(buffer); !strmap_iter_done(lhist_it);
for (lhist_it = strmap_iter_init(or_history->link_history_map); lhist_it = strmap_iter_next(or_history->link_history_map, lhist_it)) {
!strmap_iter_done(lhist_it); strmap_iter_get(lhist_it, &hexdigest2, &link_history_p);
lhist_it = strmap_iter_next(or_history->link_history_map, lhist_it)) { if ((r = router_get_by_hexdigest(hexdigest2)))
strmap_iter_get(lhist_it, &hexdigest2, &link_history_p); name2 = r->nickname;
if ((r = router_get_by_hexdigest(hexdigest2))) else
name2 = r->nickname; name2 = "(unknown)";
else
name2 = "(unknown)";
link_history = (link_history_t*) link_history_p; link_history = (link_history_t*) link_history_p;
len += snprintf(buffer+len, 2048-len, "%s(%ld/%ld); ", name2, len += snprintf(buffer+len, 2048-len, "%s(%ld/%ld); ", name2,
link_history->n_extend_ok, link_history->n_extend_ok,
link_history->n_extend_ok+link_history->n_extend_fail); link_history->n_extend_ok+link_history->n_extend_fail);
if (len >= 2048) { if (len >= 2048) {
buffer[2047]='\0'; buffer[2047]='\0';
break; break;
}
} }
log(severity, buffer);
} }
log(severity, buffer);
} }
} }