Skip to content

Commit

Permalink
Fixed possibility that packet_send_rate would get stuck.
Browse files Browse the repository at this point in the history
  • Loading branch information
irungentoo committed May 15, 2014
1 parent c5559e1 commit 1e7164f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions toxcore/net_crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}

Expand Down

0 comments on commit 1e7164f

Please sign in to comment.