mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 06:54:15 +00:00
limit expiration by next midnight for encrypted LS2
This commit is contained in:
parent
d248343517
commit
5d5cd71714
@ -872,10 +872,11 @@ namespace data
|
|||||||
memcpy (m_Buffer + offset, blindedPub, 32); offset += 32; // Blinded Public Key
|
memcpy (m_Buffer + offset, blindedPub, 32); offset += 32; // Blinded Public Key
|
||||||
auto timestamp = i2p::util::GetSecondsSinceEpoch ();
|
auto timestamp = i2p::util::GetSecondsSinceEpoch ();
|
||||||
htobe32buf (m_Buffer + offset, timestamp); offset += 4; // published timestamp (seconds)
|
htobe32buf (m_Buffer + offset, timestamp); offset += 4; // published timestamp (seconds)
|
||||||
auto expirationTime = ls->GetExpirationTime ();
|
auto nextMidnight = (timestamp/86400LL + 1)*86400LL; // 86400 = 24*3600 seconds
|
||||||
SetExpirationTime (expirationTime);
|
auto expirationTime = ls->GetExpirationTime ()/1000LL;
|
||||||
auto expires = expirationTime/1000LL - timestamp;
|
if (expirationTime > nextMidnight) expirationTime = nextMidnight;
|
||||||
htobe16buf (m_Buffer + offset, expires > 0 ? expires : 0); offset += 2; // expires
|
SetExpirationTime (expirationTime*1000LL);
|
||||||
|
htobe16buf (m_Buffer + offset, expirationTime > timestamp ? expirationTime - timestamp : 0); offset += 2; // expires
|
||||||
uint16_t flags = 0;
|
uint16_t flags = 0;
|
||||||
htobe16buf (m_Buffer + offset, flags); offset += 2; // flags
|
htobe16buf (m_Buffer + offset, flags); offset += 2; // flags
|
||||||
htobe16buf (m_Buffer + offset, lenOuterCiphertext); offset += 2; // lenOuterCiphertext
|
htobe16buf (m_Buffer + offset, lenOuterCiphertext); offset += 2; // lenOuterCiphertext
|
||||||
|
Loading…
x
Reference in New Issue
Block a user