From 1e7164fcee879a4392ccb45c80607bd5b5c71352 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Thu, 15 May 2014 16:49:39 -0400 Subject: [PATCH] Fixed possibility that packet_send_rate would get stuck. --- toxcore/net_crypto.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 685ce653..41efc1b1 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c @@ -1549,15 +1549,15 @@ static void send_crypto_packets(Net_Crypto *c) if ((double)num_packets_array(&conn->send_array) < 0.3 * (conn->packet_send_rate)) { conn->packet_send_rate *= 1.2; - } else if ((double)num_packets_array(&conn->send_array) > 0.5 * (conn->packet_send_rate)) { + } else if ((double)num_packets_array(&conn->send_array) > 0.4 * (conn->packet_send_rate)) { conn->packet_send_rate *= 0.8; } if (conn->packet_send_rate < CRYPTO_PACKET_MIN_RATE || !conn->sending) conn->packet_send_rate = CRYPTO_PACKET_MIN_RATE; - if (conn->packet_send_rate > CRYPTO_PACKET_BUFFER_SIZE * 8) - conn->packet_send_rate = CRYPTO_PACKET_BUFFER_SIZE * 8; + if (conn->packet_send_rate > CRYPTO_PACKET_BUFFER_SIZE * 2) + conn->packet_send_rate = CRYPTO_PACKET_BUFFER_SIZE * 2; }