From de5a33e8520b99775caee8d4a304703a50ef862e Mon Sep 17 00:00:00 2001 From: irungentoo Date: Tue, 3 Jun 2014 20:17:31 -0400 Subject: [PATCH] Tweaked file transfers a bit. --- toxcore/net_crypto.c | 6 +++++- toxcore/net_crypto.h | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 033f494b..1b78bf1b 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c @@ -2142,6 +2142,9 @@ static int udp_handle_packet(void *object, IP_Port source, uint8_t *packet, uint return 0; } +/* Value to set sending variable */ +#define CONN_SENDING_VALUE 2 + /* The dT for the average packet recieving rate calculations. Also used as the */ #define PACKET_COUNTER_AVERAGE_INTERVAL 200 @@ -2291,6 +2294,7 @@ static void send_crypto_packets(Net_Crypto *c) int ret = send_requested_packets(c, i, conn->packets_left); if (ret != -1) { + conn->sending = CONN_SENDING_VALUE; conn->packets_resent += ret; conn->packets_left -= ret; } @@ -2372,7 +2376,7 @@ int64_t write_cryptpacket(Net_Crypto *c, int crypt_connection_id, uint8_t *data, return -1; --conn->packets_left; - conn->sending = CRYPTO_MIN_QUEUE_LENGTH; + conn->sending = CONN_SENDING_VALUE; return ret; } diff --git a/toxcore/net_crypto.h b/toxcore/net_crypto.h index ebbfb8d3..78e2f56b 100644 --- a/toxcore/net_crypto.h +++ b/toxcore/net_crypto.h @@ -37,7 +37,7 @@ #define CRYPTO_PACKET_BUFFER_SIZE 16384 /* Must be a power of 2 */ /* Minimum packet rate per second. */ -#define CRYPTO_PACKET_MIN_RATE 40.0 +#define CRYPTO_PACKET_MIN_RATE 8.0 /* Minimum packet queue max length. */ #define CRYPTO_MIN_QUEUE_LENGTH 8