commit bbc781885dd64142c687c21339d809782444e0c7 Author: teor teor2345@gmail.com Date: Mon Dec 11 00:51:40 2017 +1100
fixup! Add networkstatus_consensus_has_ipv6() and unit tests
This is what happens when you don't run: make check-spaces make check-changes --- changes/bug23827 | 2 +- src/test/test_dir.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/changes/bug23827 b/changes/bug23827 index 6954ef891..7c626e1b3 100644 --- a/changes/bug23827 +++ b/changes/bug23827 @@ -1,7 +1,7 @@ o Minor feature (IPv6): - When a consensus has IPv6 ORPorts, make IPv6-only clients use them, rather than waiting to download microdescriptors. - Implements #23827. + Implements 23827. - Make IPv6-only clients wait for microdescs for relays, even if we were previously using descriptors (or were using them as a bridge) and have a cached descriptor for them. diff --git a/src/test/test_dir.c b/src/test/test_dir.c index 0da4e7e15..c85f7f065 100644 --- a/src/test/test_dir.c +++ b/src/test/test_dir.c @@ -6228,25 +6228,30 @@ test_dir_networkstatus_consensus_has_ipv6(void *arg) /* Test the bounds for A lines in the microdesc consensus */ mock_options->UseMicrodescriptors = 1;
- mock_networkstatus->consensus_method = MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS; + mock_networkstatus->consensus_method = + MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS; has_ipv6 = networkstatus_consensus_has_ipv6(get_options()); tt_assert(has_ipv6);
- mock_networkstatus->consensus_method = MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS + 1; + mock_networkstatus->consensus_method = + MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS + 1; has_ipv6 = networkstatus_consensus_has_ipv6(get_options()); tt_assert(has_ipv6);
- mock_networkstatus->consensus_method = MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS + 20; + mock_networkstatus->consensus_method = + MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS + 20; has_ipv6 = networkstatus_consensus_has_ipv6(get_options()); tt_assert(has_ipv6);
- mock_networkstatus->consensus_method = MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS - 1; + mock_networkstatus->consensus_method = + MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS - 1; has_ipv6 = networkstatus_consensus_has_ipv6(get_options()); tt_assert(!has_ipv6);
/* Test the edge cases */ mock_options->UseMicrodescriptors = 1; - mock_networkstatus->consensus_method = MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS; + mock_networkstatus->consensus_method = + MIN_METHOD_FOR_A_LINES_IN_MICRODESC_CONSENSUS;
/* Reasonably live */ mock_networkstatus->valid_until = time(NULL) - 60;