summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toxcore/net_crypto.c7
-rw-r--r--toxcore/net_crypto.h2
2 files changed, 7 insertions, 2 deletions
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c
index f29183ca..f08866aa 100644
--- a/toxcore/net_crypto.c
+++ b/toxcore/net_crypto.c
@@ -2235,7 +2235,12 @@ static void send_crypto_packets(Net_Crypto *c)
2235 total_resent += conn->last_num_packets_resent[ind]; 2235 total_resent += conn->last_num_packets_resent[ind];
2236 } 2236 }
2237 2237
2238 total_sent -= sum; 2238 if (sum > 0) {
2239 total_sent -= sum;
2240 } else {
2241 if (total_resent > -sum)
2242 total_resent = -sum;
2243 }
2239 2244
2240 /* if queue is too big only allow resending packets. */ 2245 /* if queue is too big only allow resending packets. */
2241 uint32_t npackets = num_packets_array(&conn->send_array); 2246 uint32_t npackets = num_packets_array(&conn->send_array);
diff --git a/toxcore/net_crypto.h b/toxcore/net_crypto.h
index 64caf9ad..715b6e3f 100644
--- a/toxcore/net_crypto.h
+++ b/toxcore/net_crypto.h
@@ -80,7 +80,7 @@
80 80
81/* Base current transfer speed on last CONGESTION_QUEUE_ARRAY_SIZE number of points taken 81/* Base current transfer speed on last CONGESTION_QUEUE_ARRAY_SIZE number of points taken
82 at the dT defined in net_crypto.c */ 82 at the dT defined in net_crypto.c */
83#define CONGESTION_QUEUE_ARRAY_SIZE 24 83#define CONGESTION_QUEUE_ARRAY_SIZE 12
84#define CONGESTION_LAST_SENT_ARRAY_SIZE (CONGESTION_QUEUE_ARRAY_SIZE * 2) 84#define CONGESTION_LAST_SENT_ARRAY_SIZE (CONGESTION_QUEUE_ARRAY_SIZE * 2)
85 85
86/* Default connection ping in ms. */ 86/* Default connection ping in ms. */