Rate gate requests for COM.

This commit is contained in:
Adam Ierymenko 2016-09-12 15:19:21 -07:00
parent 34b146f28b
commit ea1da3321a
3 changed files with 22 additions and 5 deletions

View file

@ -393,6 +393,18 @@ public:
return false;
}
/**
* Rate gate requests for network COM
*/
inline bool rateGateComRequest(const uint64_t now)
{
if ((now - _lastComRequestReceived) >= ZT_PEER_GENERAL_RATE_LIMIT) {
_lastComRequestReceived = now;
return true;
}
return false;
}
/**
* Find a common set of addresses by which two peers can link, if any
*
@ -452,6 +464,7 @@ private:
uint64_t _lastCredentialRequestSent;
uint64_t _lastWhoisRequestReceived;
uint64_t _lastEchoRequestReceived;
uint64_t _lastComRequestReceived;
const RuntimeEnvironment *RR;
uint32_t _remoteClusterOptimal4;
uint16_t _vProto;