summaryrefslogtreecommitdiff
path: root/src/or/circuitbuild.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-07-03 00:13:41 -0400
committerNick Mathewson <nickm@torproject.org>2011-07-03 00:13:41 -0400
commit6053e11ee6540750a68a7c59a1b91727f7e10952 (patch)
treeec4893214c3552adb9f6203deb80be9a41e6f0d1 /src/or/circuitbuild.c
parent72125389979af60b659dc469159ea9be397a2ffa (diff)
downloadtor-6053e11ee6540750a68a7c59a1b91727f7e10952.tar.gz
tor-6053e11ee6540750a68a7c59a1b91727f7e10952.zip
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.
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r--src/or/circuitbuild.c14
1 files changed, 7 insertions, 7 deletions
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 <b>transport</b>.
*
- * Return:
- * 0: if transport was found successfully.
- * 1: if <b>addr</b>:<b>port</b> 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 <b>bridge</b> for its server descriptor. */