From 6053e11ee6540750a68a7c59a1b91727f7e10952 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Sun, 3 Jul 2011 00:13:41 -0400 Subject: Refactor the interfaces of transport/proxy lookup fns Returning a tristate is needless here; we can just use the yielded transport/proxy_type field to tell whether there's a proxy, and have the return indicate success/failure. Also, store the proxy_type in the or_connection_t rather than letting it get out of sync if a configuration reload happens between launching the or_connection and deciding what to say with it. --- src/or/circuitbuild.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/or/circuitbuild.c') diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c index 98d7ac32a0..aa0e996d17 100644 --- a/src/or/circuitbuild.c +++ b/src/or/circuitbuild.c @@ -4810,18 +4810,17 @@ find_bridge_by_digest(const char *digest) * bridge of ours that uses pluggable transports, place its transport * in transport. * - * Return: - * 0: if transport was found successfully. - * 1: if addr:port did not match a bridge, - * or if matched bridge was not using transports. - * -1: if we should be using a transport, but the transport could not be found. + * Return 0 on success (found a transport, or found a bridge with no + * transport, or found no bridge); return -1 if we should be using a + * transport, but the transport could not be found. */ int find_transport_by_bridge_addrport(const tor_addr_t *addr, uint16_t port, const transport_t **transport) { + *transport = NULL; if (!bridge_list) - return 1; + return 0; SMARTLIST_FOREACH_BEGIN(bridge_list, const bridge_info_t *, bridge) { if (tor_addr_eq(&bridge->addr, addr) && @@ -4839,7 +4838,8 @@ find_transport_by_bridge_addrport(const tor_addr_t *addr, uint16_t port, } } SMARTLIST_FOREACH_END(bridge); - return 1; + *transport = NULL; + return 0; } /** We need to ask bridge for its server descriptor. */ -- cgit v1.2.3-54-g00ecf