diff options
author | Maxim Biro <nurupo.contributions@gmail.com> | 2014-12-21 20:59:50 -0500 |
---|---|---|
committer | Maxim Biro <nurupo.contributions@gmail.com> | 2014-12-21 21:00:46 -0500 |
commit | 35602e12c007aec38f65c860cad5f03953c4596d (patch) | |
tree | 442a83b1419948636ec8d305eccedec7c75c8c22 /toxcore/TCP_client.c | |
parent | e9bf38499e42eec2b01ef5024f0b7092539bc11c (diff) |
Further refactoring of proxy code
Diffstat (limited to 'toxcore/TCP_client.c')
-rw-r--r-- | toxcore/TCP_client.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/toxcore/TCP_client.c b/toxcore/TCP_client.c index 0b08283f..aee309ae 100644 --- a/toxcore/TCP_client.c +++ b/toxcore/TCP_client.c | |||
@@ -37,15 +37,8 @@ | |||
37 | */ | 37 | */ |
38 | static int connect_sock_to(sock_t sock, IP_Port ip_port, TCP_Proxy_Info *proxy_info) | 38 | static int connect_sock_to(sock_t sock, IP_Port ip_port, TCP_Proxy_Info *proxy_info) |
39 | { | 39 | { |
40 | switch (proxy_info->proxy_type) { | 40 | if (proxy_info->proxy_type != TCP_PROXY_NONE) { |
41 | case TCP_PROXY_HTTP: | 41 | ip_port =proxy_info->ip_port; |
42 | ip_port = ((TCP_Proxy_HTTP*)proxy_info->proxy)->ip_port; | ||
43 | break; | ||
44 | case TCP_PROXY_SOCKS5: | ||
45 | ip_port = ((TCP_Proxy_SOCKS5*)proxy_info->proxy)->ip_port; | ||
46 | break; | ||
47 | case TCP_PROXY_NONE: | ||
48 | break; | ||
49 | } | 42 | } |
50 | 43 | ||
51 | struct sockaddr_storage addr = {0}; | 44 | struct sockaddr_storage addr = {0}; |
@@ -613,15 +606,8 @@ TCP_Client_Connection *new_TCP_connection(IP_Port ip_port, const uint8_t *public | |||
613 | 606 | ||
614 | uint8_t family = ip_port.ip.family; | 607 | uint8_t family = ip_port.ip.family; |
615 | 608 | ||
616 | switch (proxy_info->proxy_type) { | 609 | if (proxy_info->proxy_type != TCP_PROXY_NONE) { |
617 | case TCP_PROXY_HTTP: | 610 | family = proxy_info->ip_port.ip.family; |
618 | family = ((TCP_Proxy_HTTP*)proxy_info->proxy)->ip_port.ip.family; | ||
619 | break; | ||
620 | case TCP_PROXY_SOCKS5: | ||
621 | family = ((TCP_Proxy_SOCKS5*)proxy_info->proxy)->ip_port.ip.family; | ||
622 | break; | ||
623 | case TCP_PROXY_NONE: | ||
624 | break; | ||
625 | } | 611 | } |
626 | 612 | ||
627 | sock_t sock = socket(family, SOCK_STREAM, IPPROTO_TCP); | 613 | sock_t sock = socket(family, SOCK_STREAM, IPPROTO_TCP); |