diff options
author | David Goulet <dgoulet@torproject.org> | 2020-07-17 11:10:56 -0400 |
---|---|---|
committer | David Goulet <dgoulet@torproject.org> | 2020-07-20 14:54:13 -0400 |
commit | 75434a1df18e3007c286ce48a1e981a4e96e3f82 (patch) | |
tree | 7278a53e948a351ab55b2afe76c1eb8db25943ae /src/test/test_relay.c | |
parent | 230293c169f73923b290598a1df4872acf1dee68 (diff) | |
download | tor-75434a1df18e3007c286ce48a1e981a4e96e3f82.tar.gz tor-75434a1df18e3007c286ce48a1e981a4e96e3f82.zip |
relay: Use flags in relay_find_addr_to_publish()
Instead of a boolean saying "cache_only" add the concept of flags so we add
semantic through out the code and allow ourselves to have more options in the
future.
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/test/test_relay.c')
-rw-r--r-- | src/test/test_relay.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/test/test_relay.c b/src/test/test_relay.c index 5ea35b6ad0..60db98aec3 100644 --- a/src/test/test_relay.c +++ b/src/test/test_relay.c @@ -316,11 +316,13 @@ test_find_addr_to_publish(void *arg) tt_assert(tor_addr_eq(&ipv6_addr, &cache_addr)); /* 1. Address located in the resolved cache. */ - ret = relay_find_addr_to_publish(&options, AF_INET, true, &cache_addr); + ret = relay_find_addr_to_publish(&options, AF_INET, + RELAY_FIND_ADDR_CACHE_ONLY, &cache_addr); tt_assert(ret); tt_assert(tor_addr_eq(&ipv4_addr, &cache_addr)); - ret = relay_find_addr_to_publish(&options, AF_INET6, true, &cache_addr); + ret = relay_find_addr_to_publish(&options, AF_INET6, + RELAY_FIND_ADDR_CACHE_ONLY, &cache_addr); tt_assert(ret); tt_assert(tor_addr_eq(&ipv6_addr, &cache_addr)); resolved_addr_reset_last(AF_INET); @@ -330,21 +332,25 @@ test_find_addr_to_publish(void *arg) * the find_my_address() code path because that is extensively tested in * another unit tests. */ resolved_addr_set_suggested(&ipv4_addr); - ret = relay_find_addr_to_publish(&options, AF_INET, true, &cache_addr); + ret = relay_find_addr_to_publish(&options, AF_INET, + RELAY_FIND_ADDR_CACHE_ONLY, &cache_addr); tt_assert(ret); tt_assert(tor_addr_eq(&ipv4_addr, &cache_addr)); resolved_addr_set_suggested(&ipv6_addr); - ret = relay_find_addr_to_publish(&options, AF_INET6, true, &cache_addr); + ret = relay_find_addr_to_publish(&options, AF_INET6, + RELAY_FIND_ADDR_CACHE_ONLY, &cache_addr); tt_assert(ret); tt_assert(tor_addr_eq(&ipv6_addr, &cache_addr)); resolve_addr_reset_suggested(AF_INET); resolve_addr_reset_suggested(AF_INET6); /* 3. No IP anywhere. */ - ret = relay_find_addr_to_publish(&options, AF_INET, true, &cache_addr); + ret = relay_find_addr_to_publish(&options, AF_INET, + RELAY_FIND_ADDR_CACHE_ONLY, &cache_addr); tt_assert(!ret); - ret = relay_find_addr_to_publish(&options, AF_INET6, true, &cache_addr); + ret = relay_find_addr_to_publish(&options, AF_INET6, + RELAY_FIND_ADDR_CACHE_ONLY, &cache_addr); tt_assert(!ret); done: |