diff options
author | irungentoo <irungentoo@gmail.com> | 2014-05-15 16:49:39 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-05-15 16:49:39 -0400 |
commit | 1e7164fcee879a4392ccb45c80607bd5b5c71352 (patch) | |
tree | 2d34a76363f4e187f79d0ec613772fa3d451a46f /toxcore | |
parent | c5559e192dc0a9afe76b3058cb1be756bc787f37 (diff) |
Fixed possibility that packet_send_rate would get stuck.
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/net_crypto.c | 6 |
1 files 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) | |||
1549 | 1549 | ||
1550 | if ((double)num_packets_array(&conn->send_array) < 0.3 * (conn->packet_send_rate)) { | 1550 | if ((double)num_packets_array(&conn->send_array) < 0.3 * (conn->packet_send_rate)) { |
1551 | conn->packet_send_rate *= 1.2; | 1551 | conn->packet_send_rate *= 1.2; |
1552 | } else if ((double)num_packets_array(&conn->send_array) > 0.5 * (conn->packet_send_rate)) { | 1552 | } else if ((double)num_packets_array(&conn->send_array) > 0.4 * (conn->packet_send_rate)) { |
1553 | conn->packet_send_rate *= 0.8; | 1553 | conn->packet_send_rate *= 0.8; |
1554 | } | 1554 | } |
1555 | 1555 | ||
1556 | if (conn->packet_send_rate < CRYPTO_PACKET_MIN_RATE || !conn->sending) | 1556 | if (conn->packet_send_rate < CRYPTO_PACKET_MIN_RATE || !conn->sending) |
1557 | conn->packet_send_rate = CRYPTO_PACKET_MIN_RATE; | 1557 | conn->packet_send_rate = CRYPTO_PACKET_MIN_RATE; |
1558 | 1558 | ||
1559 | if (conn->packet_send_rate > CRYPTO_PACKET_BUFFER_SIZE * 8) | 1559 | if (conn->packet_send_rate > CRYPTO_PACKET_BUFFER_SIZE * 2) |
1560 | conn->packet_send_rate = CRYPTO_PACKET_BUFFER_SIZE * 8; | 1560 | conn->packet_send_rate = CRYPTO_PACKET_BUFFER_SIZE * 2; |
1561 | 1561 | ||
1562 | } | 1562 | } |
1563 | 1563 | ||