diff options
Diffstat (limited to 'src/feature/dircache/dirserv.c')
-rw-r--r-- | src/feature/dircache/dirserv.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/feature/dircache/dirserv.c b/src/feature/dircache/dirserv.c index 1500467ec0..ea7b29c464 100644 --- a/src/feature/dircache/dirserv.c +++ b/src/feature/dircache/dirserv.c @@ -2599,12 +2599,14 @@ measured_bw_line_apply(measured_bw_line_t *parsed_line, } /** - * Read the measured bandwidth file and apply it to the list of - * vote_routerstatus_t. Returns -1 on error, 0 otherwise. + * Read the measured bandwidth list file, apply it to the list of + * vote_routerstatus_t and store all the headers in <b>bwlist_headers</b>. + * Returns -1 on error, 0 otherwise. */ int dirserv_read_measured_bandwidths(const char *from_file, - smartlist_t *routerstatuses) + smartlist_t *routerstatuses, + smartlist_t *bwlist_headers) { FILE *fp = tor_fopen_cloexec(from_file, "r"); int applied_lines = 0; @@ -2654,6 +2656,8 @@ dirserv_read_measured_bandwidths(const char *from_file, goto err; } + smartlist_add_asprintf(bwlist_headers, "timestamp=%ld", file_time); + if (routerstatuses) smartlist_sort(routerstatuses, compare_vote_routerstatus_entries); @@ -2669,6 +2673,11 @@ dirserv_read_measured_bandwidths(const char *from_file, dirserv_cache_measured_bw(&parsed_line, file_time); if (measured_bw_line_apply(&parsed_line, routerstatuses) > 0) applied_lines++; + } else { + if (strcmp(line, "====\n") != 0) { + line[strlen(line)-1] = '\0'; + smartlist_add_strdup(bwlist_headers, line); + }; } } } |