So that we ensure that tor will still continue to read V3BandwidthsFile documents when we add new headers to it in version 1.1.0, as proposed in legacy/trac#25869 (moved)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
To test the header, would it be possible to refactor the code as proposed in legacy/trac#25960 (moved), or there should not be any change to the code here?
Even if we go for 2.0.0 (without passing by 1.1.0 first),
the old format should still be backported, and it does not matter whether the additional
header lines are KeyValue or use SP
legacy/trac69717 a commit with unit tests for the relay lines
This is already done by test_dir_measured_bw_kb.
For the test where node_id failed to be at the end, it's done in legacy/trac#26004 (moved), commit dbc80ad1
legacy/trac69717 a commit that refactors the code so you can test a whole file
There is at least one more memleak in the unittests. Example:
+ tor_asprintf(&content, "%ld\n%s%s", timestamp, v110_header_lines,+ sbws_relay_lines);+ write_str_to_file(fname, content, 0);+ log_debug(LD_DIRSERV, "Bandwidth list file with additional headers and "+ "sbws RelayLine.");+ tt_int_op(0, OP_EQ, dirserv_read_measured_bandwidths(fname, NULL));++ done:+ teardown_capture_of_logs();+}
Please use ASAN or valgrind to ensure that all memleaks are fixed. Check out doc/HACKING/HelpfulTools.md on how to use valgrind.
Commit 2e8c0b9054 adds header_ended argument to measured_bw_line_parse() but does not document what it does in the function doc. Also the name header_ended is a bit weird, what does it mean?
It's also not entirely clear what header_ended is supposed to do in dirserv_read_measured_bandwidths(). Why do we change it to 1? Perhaps a comment would be helpful.
There is trailing whitespace around the new code. Please use make check-spaces to fix that. It must be clean before merging.
I think the changelog entries are too detailed and also too vague at the same time. Example of vagueness:
+ o Minor feature (unit tests):+ - Test that incomplete lines only give warnings when the end of the header+ has not been detected
Incomplete lines of what? There is no mention of bwauths in the changes entry.
IMO, we should just add a single entry under Minor feature (unit tests): that says Improve bandwidth measurement unittests and that should be enough. Anyone who cares about the specific unittests, can just look at the commit themselves.
I pushed a branch ticket25947_032_03_refactor with a few changes:
a) Renamed end_header variable to line_is_after_headers to follow the boolean variable convention of tor. Also clarified a few comments.
b) Fixed some trailing whitespace and double lines that were making make check-spaces complain.
c) Slightly edited the changes file to follow usual convention.
Juga, if you like the changes, please squash them into your branch (so that in the end you only have 4 commits) and let's turn this to merge_ready.
Also, please test this branch against torflow and swbws to make sure sbws to make sure that it functions properly. Let me know if you can't do this and I will do it if needed.
I agree with the changes and have squashed them in my ticket25947_032_03_refactor branch.
I've run the branch using torflow and sbws generated bandwidth file, and there was no any warnings (grep -r warn /pathtotorlogs/*.log|grep -i bandwidth).