commit 066d2deb3d322e960600d80739739199d8c4cfa6 Author: teor teor@torproject.org Date: Thu Apr 30 06:31:05 2020 +1000
channel: Refactor matches target address function
Refactor channel_matches_target_addr_for_extend() to return a boolean result.
Part of 33817. --- src/core/or/channel.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/core/or/channel.c b/src/core/or/channel.c index 93245ce81..a05554472 100644 --- a/src/core/or/channel.c +++ b/src/core/or/channel.c @@ -85,7 +85,7 @@
/* Static function prototypes */
-static int channel_matches_target_addr_for_extend( +static bool channel_matches_target_addr_for_extend( channel_t *chan, const tor_addr_t *target_ipv4_addr, const tor_addr_t *target_ipv6_addr); @@ -2412,7 +2412,7 @@ channel_get_for_extend,(const char *rsa_id_digest, continue; }
- const int matches_target = + const bool matches_target = channel_matches_target_addr_for_extend(chan, target_ipv4_addr, target_ipv6_addr); @@ -3317,7 +3317,7 @@ channel_matches_extend_info(channel_t *chan, extend_info_t *extend_info) * This function calls into the lower layer and asks if this channel thinks * it matches the target addresses for circuit extension purposes. */ -int +static bool channel_matches_target_addr_for_extend(channel_t *chan, const tor_addr_t *target_ipv4_addr, const tor_addr_t *target_ipv6_addr) @@ -3326,15 +3326,15 @@ channel_matches_target_addr_for_extend(channel_t *chan, tor_assert(chan->matches_target);
IF_BUG_ONCE(!target_ipv4_addr && !target_ipv6_addr) - return 0; + return false;
if (target_ipv4_addr && chan->matches_target(chan, target_ipv4_addr)) - return 1; + return true;
if (target_ipv6_addr && chan->matches_target(chan, target_ipv6_addr)) - return 1; + return true;
- return 0; + return false; }
/**