diff options
author | irungentoo <irungentoo@gmail.com> | 2014-05-18 13:45:33 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-05-18 13:45:33 -0400 |
commit | d68197b8955066be83b79d7b9f823de03e83565a (patch) | |
tree | c4baaa1b878ec9d7107ee026b9276ad38889feb0 /toxcore/net_crypto.c | |
parent | 8cb3ddda8b42441f135df38e283ac3c3d1d075a4 (diff) |
Save a couple TCP relays on save and reconnect to them on load.
Removed some old code.
Diffstat (limited to 'toxcore/net_crypto.c')
-rw-r--r-- | toxcore/net_crypto.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 1fcd434e..875c639f 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -1778,6 +1778,9 @@ int add_tcp_relay_peer(Net_Crypto *c, int crypt_connection_id, IP_Port ip_port, | |||
1778 | ip_port.ip.family = AF_INET6; | 1778 | ip_port.ip.family = AF_INET6; |
1779 | } | 1779 | } |
1780 | 1780 | ||
1781 | if (ip_port.ip.family != AF_INET && ip_port.ip.family != AF_INET6) | ||
1782 | return -1; | ||
1783 | |||
1781 | uint32_t i; | 1784 | uint32_t i; |
1782 | 1785 | ||
1783 | for (i = 0; i < conn->num_tcp_relays; ++i) { | 1786 | for (i = 0; i < conn->num_tcp_relays; ++i) { |
@@ -1817,6 +1820,15 @@ int add_tcp_relay_peer(Net_Crypto *c, int crypt_connection_id, IP_Port ip_port, | |||
1817 | */ | 1820 | */ |
1818 | int add_tcp_relay(Net_Crypto *c, IP_Port ip_port, uint8_t *public_key) | 1821 | int add_tcp_relay(Net_Crypto *c, IP_Port ip_port, uint8_t *public_key) |
1819 | { | 1822 | { |
1823 | if (ip_port.ip.family == TCP_INET) { | ||
1824 | ip_port.ip.family = AF_INET; | ||
1825 | } else if (ip_port.ip.family == TCP_INET6) { | ||
1826 | ip_port.ip.family = AF_INET6; | ||
1827 | } | ||
1828 | |||
1829 | if (ip_port.ip.family != AF_INET && ip_port.ip.family != AF_INET6) | ||
1830 | return -1; | ||
1831 | |||
1820 | if (tcp_connection_check(c, public_key) != 0) | 1832 | if (tcp_connection_check(c, public_key) != 0) |
1821 | return -1; | 1833 | return -1; |
1822 | 1834 | ||