diff options
-rw-r--r-- | toxcore/net_crypto.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index ab0fb03a..0ed855bb 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -1647,7 +1647,12 @@ int set_direct_ip_port(Net_Crypto *c, int crypt_connection_id, IP_Port ip_port) | |||
1647 | 1647 | ||
1648 | if (!ipport_equal(&ip_port, &conn->ip_port)) { | 1648 | if (!ipport_equal(&ip_port, &conn->ip_port)) { |
1649 | if ((UDP_DIRECT_TIMEOUT + conn->direct_lastrecv_time) > unix_time()) { | 1649 | if ((UDP_DIRECT_TIMEOUT + conn->direct_lastrecv_time) > unix_time()) { |
1650 | if (LAN_ip(ip_port.ip) == 0 && LAN_ip(conn->ip_port.ip) == 0 && conn->ip_port.port == ip_port.port) | 1650 | /* We already know a LAN ip, no need to switch. */ |
1651 | if (LAN_ip(conn->ip_port.ip) == 0) | ||
1652 | return -1; | ||
1653 | |||
1654 | /* Prefer ipv6. */ | ||
1655 | if (conn->ip_port.ip.family == AF_INET6 && ip_port.ip.family == AF_INET) | ||
1651 | return -1; | 1656 | return -1; |
1652 | } | 1657 | } |
1653 | 1658 | ||