diff options
author | Roger Dingledine <arma@torproject.org> | 2004-08-18 09:57:50 +0000 |
---|---|---|
committer | Roger Dingledine <arma@torproject.org> | 2004-08-18 09:57:50 +0000 |
commit | 20b88190238a9fe4ba3399e45f1f3e068fdba2e4 (patch) | |
tree | 2230885c1436c133174684971116ecbea6c1eee5 | |
parent | a447570036453ee2a5e3a3fda263aaf754b73021 (diff) | |
download | tor-20b88190238a9fe4ba3399e45f1f3e068fdba2e4.tar tor-20b88190238a9fe4ba3399e45f1f3e068fdba2e4.tar.gz |
even better, only print extend attempts if there are any.
svn:r2285
-rw-r--r-- | src/or/rephist.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c index 603077ce5..1638d52e1 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -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, 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: "); - else - *buffer = '\0'; - len = strlen(buffer); - for (lhist_it = strmap_iter_init(or_history->link_history_map); - !strmap_iter_done(lhist_it); - lhist_it = strmap_iter_next(or_history->link_history_map, lhist_it)) { - strmap_iter_get(lhist_it, &hexdigest2, &link_history_p); - if ((r = router_get_by_hexdigest(hexdigest2))) - name2 = r->nickname; - else - name2 = "(unknown)"; - - link_history = (link_history_t*) link_history_p; - len += snprintf(buffer+len, 2048-len, "%s(%ld/%ld); ", name2, - link_history->n_extend_ok, - link_history->n_extend_ok+link_history->n_extend_fail); - if (len >= 2048) { - buffer[2047]='\0'; - break; + len = strlen(buffer); + for (lhist_it = strmap_iter_init(or_history->link_history_map); + !strmap_iter_done(lhist_it); + lhist_it = strmap_iter_next(or_history->link_history_map, lhist_it)) { + strmap_iter_get(lhist_it, &hexdigest2, &link_history_p); + if ((r = router_get_by_hexdigest(hexdigest2))) + name2 = r->nickname; + else + name2 = "(unknown)"; + + link_history = (link_history_t*) link_history_p; + len += snprintf(buffer+len, 2048-len, "%s(%ld/%ld); ", name2, + link_history->n_extend_ok, + link_history->n_extend_ok+link_history->n_extend_fail); + if (len >= 2048) { + buffer[2047]='\0'; + break; + } } + log(severity, buffer); } - log(severity, buffer); } } |