mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-27 21:34:17 +00:00
delete unconfirmed LeaseSet and DeliveryStatus
This commit is contained in:
parent
45145fa50a
commit
b5bc05ac2b
@ -571,6 +571,12 @@ namespace garlic
|
|||||||
}
|
}
|
||||||
m_NumReceiveTags += numTags;
|
m_NumReceiveTags += numTags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ECIESX25519AEADRatchetSession::CheckExpired (uint64_t ts)
|
||||||
|
{
|
||||||
|
CleanupUnconfirmedLeaseSet (ts);
|
||||||
|
return ts > m_LastActivityTimestamp + ECIESX25519_EXPIRATION_TIMEOUT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ namespace garlic
|
|||||||
if (!m_Destination) m_Destination.reset (new i2p::data::IdentHash (dest));
|
if (!m_Destination) m_Destination.reset (new i2p::data::IdentHash (dest));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsExpired (uint64_t ts) const { return ts > m_LastActivityTimestamp + ECIESX25519_EXPIRATION_TIMEOUT; }
|
bool CheckExpired (uint64_t ts); // true is expired
|
||||||
bool CanBeRestarted (uint64_t ts) const { return ts > m_LastActivityTimestamp + ECIESX25519_RESTART_TIMEOUT; }
|
bool CanBeRestarted (uint64_t ts) const { return ts > m_LastActivityTimestamp + ECIESX25519_RESTART_TIMEOUT; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -70,6 +70,16 @@ namespace garlic
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GarlicRoutingSession::CleanupUnconfirmedLeaseSet (uint64_t ts)
|
||||||
|
{
|
||||||
|
if (m_LeaseSetUpdateMsgID && ts*1000LL > m_LeaseSetSubmissionTime + LEASET_CONFIRMATION_TIMEOUT)
|
||||||
|
{
|
||||||
|
if (GetOwner ())
|
||||||
|
GetOwner ()->RemoveDeliveryStatusSession (m_LeaseSetUpdateMsgID);
|
||||||
|
m_LeaseSetUpdateMsgID = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<I2NPMessage> GarlicRoutingSession::CreateEncryptedDeliveryStatusMsg (uint32_t msgID)
|
std::shared_ptr<I2NPMessage> GarlicRoutingSession::CreateEncryptedDeliveryStatusMsg (uint32_t msgID)
|
||||||
{
|
{
|
||||||
auto msg = CreateDeliveryStatusMsg (msgID);
|
auto msg = CreateDeliveryStatusMsg (msgID);
|
||||||
@ -390,12 +400,7 @@ namespace garlic
|
|||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
CleanupUnconfirmedTags ();
|
CleanupUnconfirmedTags ();
|
||||||
if (GetLeaseSetUpdateMsgID () && ts*1000LL > GetLeaseSetSubmissionTime () + LEASET_CONFIRMATION_TIMEOUT)
|
CleanupUnconfirmedLeaseSet (ts);
|
||||||
{
|
|
||||||
if (GetOwner ())
|
|
||||||
GetOwner ()->RemoveDeliveryStatusSession (GetLeaseSetUpdateMsgID ());
|
|
||||||
SetLeaseSetUpdateMsgID (0);
|
|
||||||
}
|
|
||||||
return !m_SessionTags.empty () || !m_UnconfirmedTagsMsgs.empty ();
|
return !m_SessionTags.empty () || !m_UnconfirmedTagsMsgs.empty ();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -767,7 +772,7 @@ namespace garlic
|
|||||||
|
|
||||||
for (auto it = m_ECIESx25519Sessions.begin (); it != m_ECIESx25519Sessions.end ();)
|
for (auto it = m_ECIESx25519Sessions.begin (); it != m_ECIESx25519Sessions.end ();)
|
||||||
{
|
{
|
||||||
if (it->second->IsExpired (ts))
|
if (it->second->CheckExpired (ts))
|
||||||
{
|
{
|
||||||
it->second->SetOwner (nullptr);
|
it->second->SetOwner (nullptr);
|
||||||
it = m_ECIESx25519Sessions.erase (it);
|
it = m_ECIESx25519Sessions.erase (it);
|
||||||
|
@ -113,7 +113,8 @@ namespace garlic
|
|||||||
bool IsLeaseSetNonConfirmed () const { return m_LeaseSetUpdateStatus == eLeaseSetSubmitted; };
|
bool IsLeaseSetNonConfirmed () const { return m_LeaseSetUpdateStatus == eLeaseSetSubmitted; };
|
||||||
bool IsLeaseSetUpdated () const { return m_LeaseSetUpdateStatus == eLeaseSetUpdated; };
|
bool IsLeaseSetUpdated () const { return m_LeaseSetUpdateStatus == eLeaseSetUpdated; };
|
||||||
uint64_t GetLeaseSetSubmissionTime () const { return m_LeaseSetSubmissionTime; }
|
uint64_t GetLeaseSetSubmissionTime () const { return m_LeaseSetSubmissionTime; }
|
||||||
|
void CleanupUnconfirmedLeaseSet (uint64_t ts);
|
||||||
|
|
||||||
std::shared_ptr<GarlicRoutingPath> GetSharedRoutingPath ();
|
std::shared_ptr<GarlicRoutingPath> GetSharedRoutingPath ();
|
||||||
void SetSharedRoutingPath (std::shared_ptr<GarlicRoutingPath> path);
|
void SetSharedRoutingPath (std::shared_ptr<GarlicRoutingPath> path);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user