Clean up handling of COMs, network access control, and fix a backward compatiblity issue.

This commit is contained in:
Adam Ierymenko 2016-09-08 19:48:05 -07:00
parent 1f6b13b7fd
commit 16df2c3363
8 changed files with 86 additions and 58 deletions

View file

@ -154,6 +154,21 @@ public:
return nconf.com.agreesWith(_com);
}
/**
* @return True if this member has been on this network recently (or network is public)
*/
inline bool recentlyAllowedOnNetwork(const NetworkConfig &nconf) const
{
if (nconf.isPublic())
return true;
if (_com) {
const uint64_t a = _com.timestamp().first;
const std::pair<uint64_t,uint64_t> b(nconf.com.timestamp());
return ((a <= b.first) ? ((b.first - a) <= ZT_PEER_ACTIVITY_TIMEOUT) : true);
}
return false;
}
/**
* Check whether a capability or tag is within its max delta from the timestamp of our network config and newer than any blacklist cutoff time
*