diff --git a/toxcore/Messenger.c b/toxcore/Messenger.c index bb70a44a..2dd8b82a 100644 --- a/toxcore/Messenger.c +++ b/toxcore/Messenger.c @@ -1488,7 +1488,7 @@ int file_control(Messenger *m, int32_t friendnumber, uint8_t send_receive, uint8 } } -#define MIN_SLOTS_FREE 4 +#define MIN_SLOTS_FREE (CRYPTO_MIN_QUEUE_LENGTH / 2) /* Send file data. * * return 0 on success diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index dcc32486..8d598469 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c @@ -2289,7 +2289,7 @@ static void send_crypto_packets(Net_Crypto *c) if (conn->last_packets_left_set == 0) { conn->last_packets_left_set = temp_time; - conn->packets_left = conn->packet_send_rate; + conn->packets_left = CRYPTO_MIN_QUEUE_LENGTH; } else if (((1000.0 / conn->packet_send_rate) + conn->last_packets_left_set) < temp_time) { uint32_t num_packets = conn->packet_send_rate * ((double)(temp_time - conn->last_packets_left_set) / 1000.0) + 0.5; diff --git a/toxcore/net_crypto.h b/toxcore/net_crypto.h index ee790f24..d30d5a63 100644 --- a/toxcore/net_crypto.h +++ b/toxcore/net_crypto.h @@ -41,7 +41,7 @@ #define CRYPTO_PACKET_MIN_RATE 16.0 /* Minimum packet queue max length. */ -#define CRYPTO_MIN_QUEUE_LENGTH 8 +#define CRYPTO_MIN_QUEUE_LENGTH 16 #define MAX_CRYPTO_PACKET_SIZE 1400