add primordial goo tier "hidden mode" (aka toy feature needs more work doesn't do it correctly all the way)

This commit is contained in:
Jeff Becker 2016-06-18 11:10:58 -04:00
parent 004a93a841
commit 93deb37c94
No known key found for this signature in database
GPG key ID: AB950234D6EA286B
5 changed files with 27 additions and 4 deletions

View file

@ -24,7 +24,7 @@ namespace data
{
NetDb netdb;
NetDb::NetDb (): m_IsRunning (false), m_Thread (nullptr), m_Reseeder (nullptr), m_Storage("netDb", "r", "routerInfo-", "dat")
NetDb::NetDb (): m_IsRunning (false), m_Thread (nullptr), m_Reseeder (nullptr), m_Storage("netDb", "r", "routerInfo-", "dat"), m_HiddenMode(false)
{
}
@ -121,7 +121,11 @@ namespace data
ManageLookupResponses ();
}
lastSave = ts;
}
}
// if we're in hidden mode don't publish or explore
if (m_HiddenMode) continue;
if (ts - lastPublish >= 2400) // publish every 40 minutes
{
Publish ();
@ -161,6 +165,11 @@ namespace data
return false;
}
void NetDb::SetHidden(bool hide) {
// TODO: remove reachable addresses from router info
m_HiddenMode = hide;
}
bool NetDb::AddRouterInfo (const IdentHash& ident, const uint8_t * buf, int len)
{
bool updated = true;