|
@@ -523,6 +523,30 @@ public:
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Rate limit gate for VERB_QOS_MEASUREMENT
|
|
|
+ */
|
|
|
+ inline bool rateGateQoS(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);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Rate limit gate for VERB_ACK
|
|
|
+ */
|
|
|
+ inline bool rateGateACK(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);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Serialize a peer for storage in local cache
|
|
|
*
|
|
@@ -620,6 +644,8 @@ private:
|
|
|
int64_t _lastComRequestSent;
|
|
|
int64_t _lastCredentialsReceived;
|
|
|
int64_t _lastTrustEstablishedPacketReceived;
|
|
|
+ int64_t _lastQoSReceive;
|
|
|
+ int64_t _lastACKReceive;
|
|
|
int64_t _lastSentFullHello;
|
|
|
int64_t _lastPathPrune;
|
|
|
|
|
@@ -635,6 +661,8 @@ private:
|
|
|
|
|
|
unsigned int _directPathPushCutoffCount;
|
|
|
unsigned int _credentialsCutoffCount;
|
|
|
+ unsigned int _QoSCutoffCount;
|
|
|
+ unsigned int _ACKCutoffCount;
|
|
|
|
|
|
AtomicCounter __refCount;
|
|
|
|