mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
remove already expired LeaseSets
This commit is contained in:
parent
bb5ed0b40c
commit
823b499a02
|
@ -386,7 +386,7 @@ namespace client
|
||||||
if (leaseSet->IsNewer (buf + offset, len - offset))
|
if (leaseSet->IsNewer (buf + offset, len - offset))
|
||||||
{
|
{
|
||||||
leaseSet->Update (buf + offset, len - offset);
|
leaseSet->Update (buf + offset, len - offset);
|
||||||
if (leaseSet->IsValid () && leaseSet->GetIdentHash () == key)
|
if (leaseSet->IsValid () && leaseSet->GetIdentHash () == key && !leaseSet->IsExpired ())
|
||||||
LogPrint (eLogDebug, "Destination: Remote LeaseSet updated");
|
LogPrint (eLogDebug, "Destination: Remote LeaseSet updated");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -405,7 +405,7 @@ namespace client
|
||||||
leaseSet = std::make_shared<i2p::data::LeaseSet> (buf + offset, len - offset); // LeaseSet
|
leaseSet = std::make_shared<i2p::data::LeaseSet> (buf + offset, len - offset); // LeaseSet
|
||||||
else
|
else
|
||||||
leaseSet = std::make_shared<i2p::data::LeaseSet2> (buf[DATABASE_STORE_TYPE_OFFSET], buf + offset, len - offset, true, GetPreferredCryptoType () ); // LeaseSet2
|
leaseSet = std::make_shared<i2p::data::LeaseSet2> (buf[DATABASE_STORE_TYPE_OFFSET], buf + offset, len - offset, true, GetPreferredCryptoType () ); // LeaseSet2
|
||||||
if (leaseSet->IsValid () && leaseSet->GetIdentHash () == key)
|
if (leaseSet->IsValid () && leaseSet->GetIdentHash () == key && !leaseSet->IsExpired ())
|
||||||
{
|
{
|
||||||
if (leaseSet->GetIdentHash () != GetIdentHash ())
|
if (leaseSet->GetIdentHash () != GetIdentHash ())
|
||||||
{
|
{
|
||||||
|
|
|
@ -336,7 +336,7 @@ namespace data
|
||||||
if (it == m_LeaseSets.end () || it->second->GetStoreType () != storeType ||
|
if (it == m_LeaseSets.end () || it->second->GetStoreType () != storeType ||
|
||||||
leaseSet->GetPublishedTimestamp () > it->second->GetPublishedTimestamp ())
|
leaseSet->GetPublishedTimestamp () > it->second->GetPublishedTimestamp ())
|
||||||
{
|
{
|
||||||
if (leaseSet->IsPublic ())
|
if (leaseSet->IsPublic () && !leaseSet->IsExpired ())
|
||||||
{
|
{
|
||||||
// TODO: implement actual update
|
// TODO: implement actual update
|
||||||
LogPrint (eLogInfo, "NetDb: LeaseSet2 updated: ", ident.ToBase32());
|
LogPrint (eLogInfo, "NetDb: LeaseSet2 updated: ", ident.ToBase32());
|
||||||
|
@ -345,7 +345,7 @@ namespace data
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LogPrint (eLogWarning, "NetDb: Unpublished LeaseSet2 received: ", ident.ToBase32());
|
LogPrint (eLogWarning, "NetDb: Unpublished or expired LeaseSet2 received: ", ident.ToBase32());
|
||||||
m_LeaseSets.erase (ident);
|
m_LeaseSets.erase (ident);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue