diff options
-rw-r--r-- | toxcore/Messenger.h | 2 | ||||
-rw-r--r-- | toxcore/net_crypto.c | 2 | ||||
-rw-r--r-- | toxcore/net_crypto.h | 3 |
3 files changed, 5 insertions, 2 deletions
diff --git a/toxcore/Messenger.h b/toxcore/Messenger.h index 222bf3e4..51d5c73b 100644 --- a/toxcore/Messenger.h +++ b/toxcore/Messenger.h | |||
@@ -96,7 +96,7 @@ enum { | |||
96 | #define FRIEND_SHARE_RELAYS_INTERVAL (5 * 60) | 96 | #define FRIEND_SHARE_RELAYS_INTERVAL (5 * 60) |
97 | 97 | ||
98 | /* If no packets are received from friend in this time interval, kill the connection. */ | 98 | /* If no packets are received from friend in this time interval, kill the connection. */ |
99 | #define FRIEND_CONNECTION_TIMEOUT (FRIEND_PING_INTERVAL * 2) | 99 | #define FRIEND_CONNECTION_TIMEOUT (FRIEND_PING_INTERVAL * 3) |
100 | 100 | ||
101 | 101 | ||
102 | /* USERSTATUS - | 102 | /* USERSTATUS - |
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index b29184e2..033f494b 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -2427,7 +2427,7 @@ unsigned int crypto_connection_status(Net_Crypto *c, int crypt_connection_id, ui | |||
2427 | 2427 | ||
2428 | *direct_connected = 0; | 2428 | *direct_connected = 0; |
2429 | 2429 | ||
2430 | if ((CRYPTO_SEND_PACKET_INTERVAL * MAX_NUM_SENDPACKET_TRIES + conn->direct_lastrecv_time) > current_time_monotonic()) | 2430 | if ((UDP_DIRECT_TIMEOUT + conn->direct_lastrecv_time) > current_time_monotonic()) |
2431 | *direct_connected = 1; | 2431 | *direct_connected = 1; |
2432 | 2432 | ||
2433 | return conn->status; | 2433 | return conn->status; |
diff --git a/toxcore/net_crypto.h b/toxcore/net_crypto.h index 054dbb5d..ebbfb8d3 100644 --- a/toxcore/net_crypto.h +++ b/toxcore/net_crypto.h | |||
@@ -55,6 +55,9 @@ | |||
55 | before giving up. */ | 55 | before giving up. */ |
56 | #define MAX_NUM_SENDPACKET_TRIES 8 | 56 | #define MAX_NUM_SENDPACKET_TRIES 8 |
57 | 57 | ||
58 | /* The timeout of no recieved UDP packets before the direct UDP connection is considered dead. */ | ||
59 | #define UDP_DIRECT_TIMEOUT (MAX_NUM_SENDPACKET_TRIES * CRYPTO_SEND_PACKET_INTERVAL * 2) | ||
60 | |||
58 | #define PACKET_ID_PADDING 0 | 61 | #define PACKET_ID_PADDING 0 |
59 | #define PACKET_ID_REQUEST 1 | 62 | #define PACKET_ID_REQUEST 1 |
60 | #define PACKET_ID_KILL 2 | 63 | #define PACKET_ID_KILL 2 |