diff options
author | irungentoo <irungentoo@gmail.com> | 2015-11-17 18:42:01 -0500 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2015-11-17 18:42:01 -0500 |
commit | d699a9627f615f0ad9c1c0c51279461c1edda08b (patch) | |
tree | cac9cd24c3c9fb393e080e487eab829959dc65c8 /toxcore | |
parent | 4df59de5049a44ce4d0145526978aa94c10047c8 (diff) |
Don't spam request packets.
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/net_crypto.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/toxcore/net_crypto.c b/toxcore/net_crypto.c index 17748697..5cd4cba3 100644 --- a/toxcore/net_crypto.c +++ b/toxcore/net_crypto.c | |||
@@ -2141,6 +2141,9 @@ static void send_crypto_packets(Net_Crypto *c) | |||
2141 | double request_packet_interval = (REQUEST_PACKETS_COMPARE_CONSTANT / (((double)num_packets_array( | 2141 | double request_packet_interval = (REQUEST_PACKETS_COMPARE_CONSTANT / (((double)num_packets_array( |
2142 | &conn->recv_array) + 1.0) / (conn->packet_recv_rate + 1.0))); | 2142 | &conn->recv_array) + 1.0) / (conn->packet_recv_rate + 1.0))); |
2143 | 2143 | ||
2144 | if (request_packet_interval < PACKET_COUNTER_AVERAGE_INTERVAL) | ||
2145 | request_packet_interval = PACKET_COUNTER_AVERAGE_INTERVAL; | ||
2146 | |||
2144 | if (temp_time - conn->last_request_packet_sent > (uint64_t)request_packet_interval) { | 2147 | if (temp_time - conn->last_request_packet_sent > (uint64_t)request_packet_interval) { |
2145 | if (send_request_packet(c, i) == 0) { | 2148 | if (send_request_packet(c, i) == 0) { |
2146 | conn->last_request_packet_sent = temp_time; | 2149 | conn->last_request_packet_sent = temp_time; |