mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2024-11-10 01:10:32 +00:00
don't include already expired lease to LeaseSet
This commit is contained in:
parent
bd98f2c3ee
commit
c43926083e
@ -861,12 +861,13 @@ namespace data
|
|||||||
m_Buffer[offset] = num; offset++; // num leases
|
m_Buffer[offset] = num; offset++; // num leases
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
|
auto ts = tunnels[i]->GetCreationTime () + i2p::tunnel::TUNNEL_EXPIRATION_TIMEOUT - i2p::tunnel::TUNNEL_EXPIRATION_THRESHOLD; // in seconds, 1 minute before expiration
|
||||||
|
if (ts <= publishedTimestamp) continue; // already expired, skip
|
||||||
|
if (ts > expirationTime) expirationTime = ts;
|
||||||
memcpy (m_Buffer + offset, tunnels[i]->GetNextIdentHash (), 32);
|
memcpy (m_Buffer + offset, tunnels[i]->GetNextIdentHash (), 32);
|
||||||
offset += 32; // gateway id
|
offset += 32; // gateway id
|
||||||
htobe32buf (m_Buffer + offset, tunnels[i]->GetNextTunnelID ());
|
htobe32buf (m_Buffer + offset, tunnels[i]->GetNextTunnelID ());
|
||||||
offset += 4; // tunnel id
|
offset += 4; // tunnel id
|
||||||
auto ts = tunnels[i]->GetCreationTime () + i2p::tunnel::TUNNEL_EXPIRATION_TIMEOUT - i2p::tunnel::TUNNEL_EXPIRATION_THRESHOLD; // in seconds, 1 minute before expiration
|
|
||||||
if (ts > expirationTime) expirationTime = ts;
|
|
||||||
htobe32buf (m_Buffer + offset, ts);
|
htobe32buf (m_Buffer + offset, ts);
|
||||||
offset += 4; // end date
|
offset += 4; // end date
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user