summaryrefslogtreecommitdiff
path: root/node/Peer.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'node/Peer.hpp')
-rw-r--r--node/Peer.hpp36
1 files changed, 20 insertions, 16 deletions
diff --git a/node/Peer.hpp b/node/Peer.hpp
index f7c0dbbd..8807662d 100644
--- a/node/Peer.hpp
+++ b/node/Peer.hpp
@@ -524,27 +524,31 @@ public:
}
/**
- * Rate limit gate for VERB_QOS_MEASUREMENT
+ * Rate limit gate for VERB_ACK
*/
- inline bool rateGateQoS(const int64_t now)
+ inline bool rateGateACK(const int64_t now)
{
- if ((now - _lastQoSReceive) <= ZT_PATH_QOS_ACK_CUTOFF_TIME)
- ++_QoSCutoffCount;
- else _QoSCutoffCount = 0;
- _lastQoSReceive = now;
- return (_QoSCutoffCount < ZT_PATH_QOS_ACK_CUTOFF_LIMIT);
+ if ((now - _lastACKWindowReset) >= ZT_PATH_QOS_ACK_CUTOFF_TIME) {
+ _lastACKWindowReset = now;
+ _ACKCutoffCount = 0;
+ } else {
+ ++_ACKCutoffCount;
+ }
+ return (_ACKCutoffCount < ZT_PATH_QOS_ACK_CUTOFF_LIMIT);
}
/**
- * Rate limit gate for VERB_ACK
+ * Rate limit gate for VERB_QOS_MEASUREMENT
*/
- inline bool rateGateACK(const int64_t now)
+ inline bool rateGateQoS(const int64_t now)
{
- if ((now - _lastACKReceive) <= ZT_PATH_QOS_ACK_CUTOFF_TIME)
- ++_ACKCutoffCount;
- else _ACKCutoffCount = 0;
- _lastACKReceive = now;
- return (_ACKCutoffCount < ZT_PATH_QOS_ACK_CUTOFF_LIMIT);
+ if ((now - _lastQoSWindowReset) >= ZT_PATH_QOS_ACK_CUTOFF_TIME) {
+ _lastQoSWindowReset = now;
+ _QoSCutoffCount = 0;
+ } else {
+ ++_QoSCutoffCount;
+ }
+ return (_QoSCutoffCount < ZT_PATH_QOS_ACK_CUTOFF_LIMIT);
}
/**
@@ -644,10 +648,10 @@ private:
int64_t _lastComRequestSent;
int64_t _lastCredentialsReceived;
int64_t _lastTrustEstablishedPacketReceived;
- int64_t _lastQoSReceive;
- int64_t _lastACKReceive;
int64_t _lastSentFullHello;
int64_t _lastPathPrune;
+ int64_t _lastACKWindowReset;
+ int64_t _lastQoSWindowReset;
uint16_t _vProto;
uint16_t _vMajor;