Update Indentation and don't spam route changes in datagram sessions

This commit is contained in:
Jeff Becker 2016-09-03 11:46:47 -04:00
parent c770bcbf96
commit 9acbb2203c
No known key found for this signature in database
GPG key ID: AB950234D6EA286B
7 changed files with 461 additions and 382 deletions

View file

@ -163,9 +163,10 @@ namespace data
return ExtractTimestamp (buf, len) > ExtractTimestamp (m_Buffer, m_BufferLen);
}
bool LeaseSet::ExpiresSoon(const uint64_t dlt) const
bool LeaseSet::ExpiresSoon(const uint64_t dlt, const uint64_t fudge) const
{
auto now = i2p::util::GetMillisecondsSinceEpoch ();
if (fudge) now += rand() % fudge;
if (now >= m_ExpirationTime) return true;
return m_ExpirationTime - now <= dlt;
}