diff options
-rw-r--r-- | toxcore/LAN_discovery.c | 7 | ||||
-rw-r--r-- | toxcore/LAN_discovery.h | 7 | ||||
-rw-r--r-- | toxcore/net_crypto.c | 5 | ||||
-rw-r--r-- | toxcore/net_crypto.h | 1 |
4 files changed, 13 insertions, 7 deletions
diff --git a/toxcore/LAN_discovery.c b/toxcore/LAN_discovery.c index 436b16fd..74f10c98 100644 --- a/toxcore/LAN_discovery.c +++ b/toxcore/LAN_discovery.c | |||
@@ -28,6 +28,13 @@ | |||
28 | #include "LAN_discovery.h" | 28 | #include "LAN_discovery.h" |
29 | #include "util.h" | 29 | #include "util.h" |
30 | 30 | ||
31 | /* Used for get_broadcast(). */ | ||
32 | #ifdef __linux | ||
33 | #include <sys/ioctl.h> | ||
34 | #include <arpa/inet.h> | ||
35 | #include <linux/netdevice.h> | ||
36 | #endif | ||
37 | |||
31 | #define MAX_INTERFACES 16 | 38 | #define MAX_INTERFACES 16 |
32 | 39 | ||
33 | 40 | ||
diff --git a/toxcore/LAN_discovery.h b/toxcore/LAN_discovery.h index fcb094e4..5dffc3ad 100644 --- a/toxcore/LAN_discovery.h +++ b/toxcore/LAN_discovery.h | |||
@@ -28,13 +28,6 @@ | |||
28 | 28 | ||
29 | #include "DHT.h" | 29 | #include "DHT.h" |
30 | 30 | ||
31 | /* Used for get_broadcast(). */ | ||
32 | #ifdef __linux | ||
33 | #include <sys/ioctl.h> | ||
34 | #include <arpa/inet.h> | ||
35 | #include <linux/netdevice.h> | ||
36 | #endif | ||
37 | |||
38 | /* Interval in seconds between LAN discovery packet sending. */ | 31 | /* Interval in seconds between LAN discovery packet sending. */ |
39 | #define LAN_DISCOVERY_INTERVAL 10 | 32 | #define LAN_DISCOVERY_INTERVAL 10 |
40 | 33 | ||
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index c83c5d54..a36bf3ad 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -1700,6 +1700,11 @@ int set_direct_ip_port(Net_Crypto *c, int crypt_connection_id, IP_Port ip_port) | |||
1700 | return -1; | 1700 | return -1; |
1701 | 1701 | ||
1702 | if (!ipport_equal(&ip_port, &conn->ip_port)) { | 1702 | if (!ipport_equal(&ip_port, &conn->ip_port)) { |
1703 | if ((UDP_DIRECT_TIMEOUT + conn->direct_lastrecv_time) > current_time_monotonic()) { | ||
1704 | if (LAN_ip(ip_port.ip) == 0 && LAN_ip(conn->ip_port.ip) == 0 && conn->ip_port.port == ip_port.port) | ||
1705 | return -1; | ||
1706 | } | ||
1707 | |||
1703 | if (bs_list_add(&c->ip_port_list, &ip_port, crypt_connection_id)) { | 1708 | if (bs_list_add(&c->ip_port_list, &ip_port, crypt_connection_id)) { |
1704 | bs_list_remove(&c->ip_port_list, &conn->ip_port, crypt_connection_id); | 1709 | bs_list_remove(&c->ip_port_list, &conn->ip_port, crypt_connection_id); |
1705 | conn->ip_port = ip_port; | 1710 | conn->ip_port = ip_port; |
diff --git a/toxcore/net_crypto.h b/toxcore/net_crypto.h index f977e741..b9f9e31c 100644 --- a/toxcore/net_crypto.h +++ b/toxcore/net_crypto.h | |||
@@ -25,6 +25,7 @@ | |||
25 | #define NET_CRYPTO_H | 25 | #define NET_CRYPTO_H |
26 | 26 | ||
27 | #include "DHT.h" | 27 | #include "DHT.h" |
28 | #include "LAN_discovery.h" | ||
28 | #include "TCP_client.h" | 29 | #include "TCP_client.h" |
29 | #include <pthread.h> | 30 | #include <pthread.h> |
30 | 31 | ||