From d68197b8955066be83b79d7b9f823de03e83565a Mon Sep 17 00:00:00 2001 From: irungentoo Date: Sun, 18 May 2014 13:45:33 -0400 Subject: Save a couple TCP relays on save and reconnect to them on load. Removed some old code. --- toxcore/net_crypto.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'toxcore/net_crypto.c') 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, ip_port.ip.family = AF_INET6; } + if (ip_port.ip.family != AF_INET && ip_port.ip.family != AF_INET6) + return -1; + uint32_t i; 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, */ int add_tcp_relay(Net_Crypto *c, IP_Port ip_port, uint8_t *public_key) { + if (ip_port.ip.family == TCP_INET) { + ip_port.ip.family = AF_INET; + } else if (ip_port.ip.family == TCP_INET6) { + ip_port.ip.family = AF_INET6; + } + + if (ip_port.ip.family != AF_INET && ip_port.ip.family != AF_INET6) + return -1; + if (tcp_connection_check(c, public_key) != 0) return -1; -- cgit v1.2.3