diff options
author | Yawning Angel <yawning@schwanenlied.me> | 2014-05-01 03:30:09 +0000 |
---|---|---|
committer | Yawning Angel <yawning@schwanenlied.me> | 2014-05-21 08:14:39 +0000 |
commit | cd56b1a86ea255ba4bfc77959a88bfcd616ef516 (patch) | |
tree | b091df98d1cfdb47ba7be2c72b21dfc31c8b872f /src/or/connection.c | |
parent | 7a18ac7454f16a2ac592312e041f9bb9f30cae31 (diff) | |
download | tor-cd56b1a86ea255ba4bfc77959a88bfcd616ef516.tar.gz tor-cd56b1a86ea255ba4bfc77959a88bfcd616ef516.zip |
Remove get_bridge_pt_addrport().
The code was not disambiguating ClientTransportPlugin configured and
not used, and ClientTransportPlugin configured, but in a failed state.
The right thing to do is to undo moving the get_transport_by_addrport()
call back into get_proxy_addrport(), and remove and explicit check for
using a Bridge since by the time the check is made, if a Bridge is
being used, it is PT/proxy-less.
Diffstat (limited to 'src/or/connection.c')
-rw-r--r-- | src/or/connection.c | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/src/or/connection.c b/src/or/connection.c index b32cddf1f1..ff8cdf1b4a 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -86,8 +86,6 @@ static int connection_read_https_proxy_response(connection_t *conn); static void connection_send_socks5_connect(connection_t *conn); static const char *proxy_type_to_string(int proxy_type); static int get_proxy_type(void); -static int get_bridge_pt_addrport(tor_addr_t *addr, uint16_t *port, - int *proxy_type, const connection_t *conn); /** The last addresses that our network interface seemed to have been * binding to. We use this as one way to detect when our IP changes. @@ -4773,35 +4771,6 @@ assert_connection_ok(connection_t *conn, time_t now) } /** Fills <b>addr</b> and <b>port</b> with the details of the global - * pluggable transport or bridge we are using. - * <b>conn</b> contains the connection we are using the PT/bridge for. - * - * Return 0 on success, -1 on failure. - */ -static int -get_bridge_pt_addrport(tor_addr_t *addr, uint16_t *port, int *proxy_type, - const connection_t *conn) -{ - const or_options_t *options = get_options(); - - if (options->ClientTransportPlugin || options->Bridges) { - const transport_t *transport = NULL; - int r; - r = get_transport_by_bridge_addrport(&conn->addr, conn->port, &transport); - if (r<0) - return -1; - if (transport) { /* transport found */ - tor_addr_copy(addr, &transport->addr); - *port = transport->port; - *proxy_type = transport->socks_version; - return 0; - } - } - - return -1; -} - -/** Fills <b>addr</b> and <b>port</b> with the details of the global * proxy server we are using. * <b>conn</b> contains the connection we are using the proxy for. * @@ -4819,8 +4788,19 @@ get_proxy_addrport(tor_addr_t *addr, uint16_t *port, int *proxy_type, * the config to have unused ClientTransportPlugin entries. */ if (options->ClientTransportPlugin) { - if (get_bridge_pt_addrport(addr, port, proxy_type, conn) == 0) + const transport_t *transport = NULL; + int r; + r = get_transport_by_bridge_addrport(&conn->addr, conn->port, &transport); + if (r<0) + return -1; + if (transport) { /* transport found */ + tor_addr_copy(addr, &transport->addr); + *port = transport->port; + *proxy_type = transport->socks_version; return 0; + } + + /* Unused ClientTransportPlugin. */ } if (options->HTTPSProxy) { @@ -4838,8 +4818,6 @@ get_proxy_addrport(tor_addr_t *addr, uint16_t *port, int *proxy_type, *port = options->Socks5ProxyPort; *proxy_type = PROXY_SOCKS5; return 0; - } else if (options->Bridges) { - return get_bridge_pt_addrport(addr, port, proxy_type, conn); } tor_addr_make_unspec(addr); |