diff options
author | Karsten Loesing <karsten.loesing@gmx.net> | 2010-08-24 08:11:17 +0200 |
---|---|---|
committer | Karsten Loesing <karsten.loesing@gmx.net> | 2010-12-03 16:47:53 +0100 |
commit | 8db10c6d2fb0dc632f3bfdcc4a9acc5e3c7ad515 (patch) | |
tree | cb4c61bb6a325c6ef35e2dfe6966b9a2456cca9c /src | |
parent | 91fec693e01cf5ef77fddca48ed4c0ba4fcd0d1a (diff) | |
download | tor-8db10c6d2fb0dc632f3bfdcc4a9acc5e3c7ad515.tar.gz tor-8db10c6d2fb0dc632f3bfdcc4a9acc5e3c7ad515.zip |
Write bidirectional connection stats in single line.
There's no need to have a separate line conn-stats-end for the end date
and interval length with only a single line conn-bi-direct following.
Diffstat (limited to 'src')
-rw-r--r-- | src/or/rephist.c | 3 | ||||
-rw-r--r-- | src/or/router.c | 2 | ||||
-rw-r--r-- | src/test/test.c | 8 |
3 files changed, 5 insertions, 8 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c index e6398194f0..ce2dd337e8 100644 --- a/src/or/rephist.c +++ b/src/or/rephist.c @@ -2592,8 +2592,7 @@ rep_hist_format_conn_stats(time_t now) return NULL; /* Not initialized. */ format_iso_time(written, now); - tor_asprintf(&result, "conn-stats-end %s (%d s)\n" - "conn-bi-direct %d,%d,%d,%d\n", + tor_asprintf(&result, "conn-bi-direct %s (%d s) %d,%d,%d,%d\n", written, (unsigned) (now - start_of_conn_stats_interval), below_threshold, diff --git a/src/or/router.c b/src/or/router.c index 8c56bc49a9..686151a64c 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -2053,7 +2053,7 @@ extrainfo_dump_to_string(char **s_out, extrainfo_t *extrainfo, } if (options->ConnDirectionStatistics && load_stats_file("stats"PATH_SEPARATOR"conn-stats", - "conn-stats-end", now, &contents) > 0) { + "conn-bi-direct", now, &contents) > 0) { size_t pos = strlen(s); if (strlcpy(s + pos, contents, maxlen - strlen(s)) != strlen(contents)) { diff --git a/src/test/test.c b/src/test/test.c index 56a7a9a0cb..9b0251b316 100644 --- a/src/test/test.c +++ b/src/test/test.c @@ -1175,8 +1175,7 @@ test_stats(void) rep_hist_note_or_conn_bytes(2, 400000, 30000, now + 10); rep_hist_note_or_conn_bytes(2, 400000, 30000, now + 15); s = rep_hist_format_conn_stats(now + 86400); - test_streq("conn-stats-end 2010-08-12 13:27:30 (86400 s)\n" - "conn-bi-direct 0,0,1,0\n", s); + test_streq("conn-bi-direct 2010-08-12 13:27:30 (86400 s) 0,0,1,0\n", s); tor_free(s); /* Stop collecting stats, add some bytes, and ensure we don't generate @@ -1187,7 +1186,7 @@ test_stats(void) test_assert(!s); /* Re-start stats, add some bytes, reset stats, and see what history we - * get when observing no streams or bytes at all. */ + * get when observing no bytes at all. */ rep_hist_conn_stats_init(now); rep_hist_note_or_conn_bytes(1, 30000, 400000, now); rep_hist_note_or_conn_bytes(1, 30000, 400000, now + 5); @@ -1195,8 +1194,7 @@ test_stats(void) rep_hist_note_or_conn_bytes(2, 400000, 30000, now + 15); rep_hist_reset_conn_stats(now); s = rep_hist_format_conn_stats(now + 86400); - test_streq("conn-stats-end 2010-08-12 13:27:30 (86400 s)\n" - "conn-bi-direct 0,0,0,0\n", s); + test_streq("conn-bi-direct 2010-08-12 13:27:30 (86400 s) 0,0,0,0\n", s); done: tor_free(s); |