Use getPeerNoCache() in Cluster to avoid keeping all peers cached everywhere.

This commit is contained in:
Adam Ierymenko 2015-10-27 16:52:44 -07:00
commit 4221552c0b
2 changed files with 20 additions and 2 deletions

View file

@ -78,6 +78,23 @@ public:
*/
SharedPtr<Peer> getPeer(const Address &zta);
/**
* Get a peer only if it is presently in memory (no disk cache)
*
* @param zta ZeroTier address
* @param now Current time
*/
inline SharedPtr<Peer> getPeerNoCache(const Address &zta,const uint64_t now)
{
Mutex::Lock _l(_lock);
const SharedPtr<Peer> *ap = _peers.get(zta);
if (ap) {
(*ap)->use(now);
return *ap;
}
return SharedPtr<Peer>();
}
/**
* Get the identity of a peer
*