From 6e0b807f09dd3dc8eba452678058904c5fff2d76 Mon Sep 17 00:00:00 2001 From: irungentoo Date: Sat, 17 Jan 2015 21:27:38 -0500 Subject: [PATCH] Attempted fix of Tox disconnecting during file transfers by tweaking some congestion control numbers. --- toxcore/net_crypto.c | 4 ++-- toxcore/net_crypto.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 112931ad..54a53501 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c @@ -2412,7 +2412,7 @@ static int udp_handle_packet(void *object, IP_Port source, const uint8_t *packet /* The dT for the average packet receiving rate calculations. Also used as the */ -#define PACKET_COUNTER_AVERAGE_INTERVAL 100 +#define PACKET_COUNTER_AVERAGE_INTERVAL 50 /* Ratio of recv queue size / recv packet rate (in seconds) times * the number of ms between request packets to send at that ratio @@ -2495,7 +2495,7 @@ static void send_crypto_packets(Net_Crypto *c) double min_speed = 1000.0 * (((double)(total_sent)) / ((double)(CONGESTION_QUEUE_ARRAY_SIZE) * PACKET_COUNTER_AVERAGE_INTERVAL)); - conn->packet_send_rate = min_speed * 1.3; + conn->packet_send_rate = min_speed * 1.2; if (conn->packet_send_rate < CRYPTO_PACKET_MIN_RATE) { conn->packet_send_rate = CRYPTO_PACKET_MIN_RATE; diff --git a/toxcore/net_crypto.h b/toxcore/net_crypto.h index 9d699340..7e59475e 100644 --- a/toxcore/net_crypto.h +++ b/toxcore/net_crypto.h @@ -86,7 +86,7 @@ /* Base current transfer speed on last CONGESTION_QUEUE_ARRAY_SIZE number of points taken at the dT defined in net_crypto.c */ -#define CONGESTION_QUEUE_ARRAY_SIZE 8 +#define CONGESTION_QUEUE_ARRAY_SIZE 24 typedef struct { uint64_t time;