mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
Lower chances of disconnect during file transfers.
This commit is contained in:
parent
0d0b74f5a8
commit
6b7f1deb79
|
@ -2130,7 +2130,7 @@ static void send_crypto_packets(Net_Crypto *c)
|
||||||
double send_array_ratio = (((double)npackets) / min_speed);
|
double send_array_ratio = (((double)npackets) / min_speed);
|
||||||
|
|
||||||
//TODO: Improve formula?
|
//TODO: Improve formula?
|
||||||
if (send_array_ratio > 2.0 && CRYPTO_MIN_QUEUE_LENGTH * 3 < npackets) {
|
if (send_array_ratio > 2.0 && CRYPTO_MIN_QUEUE_LENGTH < npackets) {
|
||||||
conn->packet_send_rate = min_speed * (1.0 / (send_array_ratio / 2.0));
|
conn->packet_send_rate = min_speed * (1.0 / (send_array_ratio / 2.0));
|
||||||
} else if (conn->last_congestion_event + CONGESTION_EVENT_TIMEOUT < temp_time) {
|
} else if (conn->last_congestion_event + CONGESTION_EVENT_TIMEOUT < temp_time) {
|
||||||
conn->packet_send_rate = min_speed * 1.2;
|
conn->packet_send_rate = min_speed * 1.2;
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#define CRYPTO_PACKET_BUFFER_SIZE 16384 /* Must be a power of 2 */
|
#define CRYPTO_PACKET_BUFFER_SIZE 16384 /* Must be a power of 2 */
|
||||||
|
|
||||||
/* Minimum packet rate per second. */
|
/* Minimum packet rate per second. */
|
||||||
#define CRYPTO_PACKET_MIN_RATE 8.0
|
#define CRYPTO_PACKET_MIN_RATE 4.0
|
||||||
|
|
||||||
/* Minimum packet queue max length. */
|
/* Minimum packet queue max length. */
|
||||||
#define CRYPTO_MIN_QUEUE_LENGTH 64
|
#define CRYPTO_MIN_QUEUE_LENGTH 64
|
||||||
|
|
Loading…
Reference in New Issue
Block a user