diff options
author | irungentoo <irungentoo@gmail.com> | 2014-05-10 13:42:59 -0400 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2014-05-10 13:42:59 -0400 |
commit | 1e485b2c2f210f173dbae0a480e43daadd32a71a (patch) | |
tree | 863f0c049c436ade79a7bacd46b9a34e6af1fb1f /toxcore/net_crypto.h | |
parent | b0731f54cd6c891283565e0082ad06481c274415 (diff) |
Added basic congestion control to net_crypto.
Diffstat (limited to 'toxcore/net_crypto.h')
-rw-r--r-- | toxcore/net_crypto.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/toxcore/net_crypto.h b/toxcore/net_crypto.h index b06fcb10..ba5ed924 100644 --- a/toxcore/net_crypto.h +++ b/toxcore/net_crypto.h | |||
@@ -33,7 +33,13 @@ | |||
33 | #define CRYPTO_CONN_ESTABLISHED 4 | 33 | #define CRYPTO_CONN_ESTABLISHED 4 |
34 | #define CRYPTO_CONN_TIMED_OUT 5 | 34 | #define CRYPTO_CONN_TIMED_OUT 5 |
35 | 35 | ||
36 | #define CRYPTO_PACKET_BUFFER_SIZE 128 /* Must be a power of 2 */ | 36 | #define CRYPTO_PACKET_BUFFER_SIZE 16384 /* Must be a power of 2 */ |
37 | |||
38 | /* Minimum packet rate per second. */ | ||
39 | #define CRYPTO_PACKET_MIN_RATE 40.0 | ||
40 | |||
41 | /* Minimum packet queue max length. */ | ||
42 | #define CRYPTO_MIN_QUEUE_LENGTH 8 | ||
37 | 43 | ||
38 | #define MAX_CRYPTO_PACKET_SIZE 1400 | 44 | #define MAX_CRYPTO_PACKET_SIZE 1400 |
39 | 45 | ||
@@ -105,6 +111,14 @@ typedef struct { | |||
105 | uint64_t last_request_packet_sent; | 111 | uint64_t last_request_packet_sent; |
106 | 112 | ||
107 | uint32_t packet_counter; | 113 | uint32_t packet_counter; |
114 | double packet_recv_rate; | ||
115 | uint64_t packet_counter_set; | ||
116 | |||
117 | double packet_send_rate; | ||
118 | uint32_t packets_left; | ||
119 | uint64_t last_packets_left_set; | ||
120 | |||
121 | uint8_t sending; /* indicates if data is being sent or not. */ | ||
108 | } Crypto_Connection; | 122 | } Crypto_Connection; |
109 | 123 | ||
110 | typedef struct { | 124 | typedef struct { |