diff options
author | irungentoo <irungentoo@gmail.com> | 2015-03-12 18:56:33 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-03-12 18:56:33 -0400 |
commit | b4320e5fac5589692793013b8ab9a110e26fb704 (patch) | |
tree | fd0b12295320c8ef2b04a6c73ec96367e885899a | |
parent | 0d67598aedda1ca144e9eddaf7cde6efe196df78 (diff) |
File sending improvements.
Use correct double to integer conversion.
-rw-r--r-- | toxcore/net_crypto.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 4be3a098..0e700a41 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -2529,7 +2529,7 @@ static void send_crypto_packets(Net_Crypto *c) | |||
2529 | if (conn->last_packets_left_set == 0) { | 2529 | if (conn->last_packets_left_set == 0) { |
2530 | conn->last_packets_left_set = temp_time; | 2530 | conn->last_packets_left_set = temp_time; |
2531 | conn->packets_left = CRYPTO_MIN_QUEUE_LENGTH; | 2531 | conn->packets_left = CRYPTO_MIN_QUEUE_LENGTH; |
2532 | } else if (((1000.0 / conn->packet_send_rate) + conn->last_packets_left_set) < temp_time) { | 2532 | } else if (((uint64_t)((1000.0 / conn->packet_send_rate) + 0.5) + conn->last_packets_left_set) < temp_time) { |
2533 | uint32_t num_packets = conn->packet_send_rate * ((double)(temp_time - conn->last_packets_left_set) / 1000.0) + 0.5; | 2533 | uint32_t num_packets = conn->packet_send_rate * ((double)(temp_time - conn->last_packets_left_set) / 1000.0) + 0.5; |
2534 | 2534 | ||
2535 | if (conn->packets_left > num_packets * 4 + CRYPTO_MIN_QUEUE_LENGTH) { | 2535 | if (conn->packets_left > num_packets * 4 + CRYPTO_MIN_QUEUE_LENGTH) { |