summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toxcore/net_crypto.c6
-rw-r--r--toxcore/net_crypto.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c
index 5477fea7..d8e0d459 100644
--- a/toxcore/net_crypto.c
+++ b/toxcore/net_crypto.c
@@ -2450,15 +2450,15 @@ static void send_crypto_packets(Net_Crypto *c)
2450 Crypto_Connection *conn = get_crypto_connection(c, i); 2450 Crypto_Connection *conn = get_crypto_connection(c, i);
2451 2451
2452 if (conn == nullptr) { 2452 if (conn == nullptr) {
2453 return; 2453 continue;
2454 } 2454 }
2455 2455
2456 if (CRYPTO_SEND_PACKET_INTERVAL + conn->temp_packet_sent_time < temp_time) { 2456 if ((CRYPTO_SEND_PACKET_INTERVAL + conn->temp_packet_sent_time) < temp_time) {
2457 send_temp_packet(c, i); 2457 send_temp_packet(c, i);
2458 } 2458 }
2459 2459
2460 if ((conn->status == CRYPTO_CONN_NOT_CONFIRMED || conn->status == CRYPTO_CONN_ESTABLISHED) 2460 if ((conn->status == CRYPTO_CONN_NOT_CONFIRMED || conn->status == CRYPTO_CONN_ESTABLISHED)
2461 && ((CRYPTO_SEND_PACKET_INTERVAL) + conn->last_request_packet_sent) < temp_time) { 2461 && (CRYPTO_SEND_PACKET_INTERVAL + conn->last_request_packet_sent) < temp_time) {
2462 if (send_request_packet(c, i) == 0) { 2462 if (send_request_packet(c, i) == 0) {
2463 conn->last_request_packet_sent = temp_time; 2463 conn->last_request_packet_sent = temp_time;
2464 } 2464 }
diff --git a/toxcore/net_crypto.h b/toxcore/net_crypto.h
index bd00a3fe..ec55bf6f 100644
--- a/toxcore/net_crypto.h
+++ b/toxcore/net_crypto.h
@@ -62,7 +62,7 @@
62#define MAX_NUM_SENDPACKET_TRIES 8 62#define MAX_NUM_SENDPACKET_TRIES 8
63 63
64/* The timeout of no received UDP packets before the direct UDP connection is considered dead. */ 64/* The timeout of no received UDP packets before the direct UDP connection is considered dead. */
65#define UDP_DIRECT_TIMEOUT ((MAX_NUM_SENDPACKET_TRIES * CRYPTO_SEND_PACKET_INTERVAL) / 1000) 65#define UDP_DIRECT_TIMEOUT 8
66 66
67#define PACKET_ID_PADDING 0 /* Denotes padding */ 67#define PACKET_ID_PADDING 0 /* Denotes padding */
68#define PACKET_ID_REQUEST 1 /* Used to request unreceived packets */ 68#define PACKET_ID_REQUEST 1 /* Used to request unreceived packets */