mirror of
https://github.com/irungentoo/toxcore.git
synced 2024-03-22 13:30:51 +08:00
File sending improvements.
Use correct double to integer conversion.
This commit is contained in:
parent
0d67598aed
commit
b4320e5fac
|
@ -2529,7 +2529,7 @@ static void send_crypto_packets(Net_Crypto *c)
|
||||||
if (conn->last_packets_left_set == 0) {
|
if (conn->last_packets_left_set == 0) {
|
||||||
conn->last_packets_left_set = temp_time;
|
conn->last_packets_left_set = temp_time;
|
||||||
conn->packets_left = CRYPTO_MIN_QUEUE_LENGTH;
|
conn->packets_left = CRYPTO_MIN_QUEUE_LENGTH;
|
||||||
} else if (((1000.0 / conn->packet_send_rate) + conn->last_packets_left_set) < temp_time) {
|
} else if (((uint64_t)((1000.0 / conn->packet_send_rate) + 0.5) + 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;
|
uint32_t num_packets = conn->packet_send_rate * ((double)(temp_time - conn->last_packets_left_set) / 1000.0) + 0.5;
|
||||||
|
|
||||||
if (conn->packets_left > num_packets * 4 + CRYPTO_MIN_QUEUE_LENGTH) {
|
if (conn->packets_left > num_packets * 4 + CRYPTO_MIN_QUEUE_LENGTH) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user