summaryrefslogtreecommitdiff
path: root/toxcore/net_crypto.c
diff options
context:
space:
mode:
authorirungentoo <irungentoo@gmail.com>2015-11-20 21:48:25 -0500
committerirungentoo <irungentoo@gmail.com>2015-11-20 21:48:25 -0500
commit608ee07c9634d7fa9e90958c6948c1e012434c81 (patch)
tree0a840f253669961e3d0bc9ebaaec7bc83fc9ee55 /toxcore/net_crypto.c
parent994a5db1058119409005a3874c936ed6c0b49766 (diff)
File transfer fix.
Diffstat (limited to 'toxcore/net_crypto.c')
-rw-r--r--toxcore/net_crypto.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c
index a785cc17..f29183ca 100644
--- a/toxcore/net_crypto.c
+++ b/toxcore/net_crypto.c
@@ -2239,9 +2239,12 @@ static void send_crypto_packets(Net_Crypto *c)
2239 2239
2240 /* if queue is too big only allow resending packets. */ 2240 /* if queue is too big only allow resending packets. */
2241 uint32_t npackets = num_packets_array(&conn->send_array); 2241 uint32_t npackets = num_packets_array(&conn->send_array);
2242 double min_speed = 1000.0 * (((double)(total_sent + total_resent)) / ((double)(CONGESTION_QUEUE_ARRAY_SIZE) * 2242 double min_speed = 1000.0 * (((double)(total_sent)) / ((double)(CONGESTION_QUEUE_ARRAY_SIZE) *
2243 PACKET_COUNTER_AVERAGE_INTERVAL)); 2243 PACKET_COUNTER_AVERAGE_INTERVAL));
2244 2244
2245 double min_speed_request = 1000.0 * (((double)(total_sent + total_resent)) / ((double)(
2246 CONGESTION_QUEUE_ARRAY_SIZE) * PACKET_COUNTER_AVERAGE_INTERVAL));
2247
2245 if (min_speed < CRYPTO_PACKET_MIN_RATE) 2248 if (min_speed < CRYPTO_PACKET_MIN_RATE)
2246 min_speed = CRYPTO_PACKET_MIN_RATE; 2249 min_speed = CRYPTO_PACKET_MIN_RATE;
2247 2250
@@ -2256,7 +2259,7 @@ static void send_crypto_packets(Net_Crypto *c)
2256 conn->packet_send_rate = min_speed * 0.9; 2259 conn->packet_send_rate = min_speed * 0.9;
2257 } 2260 }
2258 2261
2259 conn->packet_send_rate_requested = min_speed * 1.2; 2262 conn->packet_send_rate_requested = min_speed_request * 1.2;
2260 2263
2261 if (conn->packet_send_rate < CRYPTO_PACKET_MIN_RATE) { 2264 if (conn->packet_send_rate < CRYPTO_PACKET_MIN_RATE) {
2262 conn->packet_send_rate = CRYPTO_PACKET_MIN_RATE; 2265 conn->packet_send_rate = CRYPTO_PACKET_MIN_RATE;