Browse Source

reduce range for extra tags

pull/1656/head
orignal 3 years ago
parent
commit
c6cdb26f47
  1. 3
      libi2pd/ECIESX25519AEADRatchetSession.h
  2. 2
      libi2pd/Garlic.cpp

3
libi2pd/ECIESX25519AEADRatchetSession.h

@ -88,7 +88,8 @@ namespace garlic @@ -88,7 +88,8 @@ namespace garlic
bool IsNS () const { return m_IsNS; };
std::shared_ptr<ECIESX25519AEADRatchetSession> GetSession () { return m_Session; };
void SetTrimBehind (int index) { if (index > m_TrimBehindIndex) m_TrimBehindIndex = index; };
int GetTrimBehind () const { return m_TrimBehindIndex; };
void Expire ();
bool IsExpired (uint64_t ts) const;

2
libi2pd/Garlic.cpp

@ -553,7 +553,7 @@ namespace garlic @@ -553,7 +553,7 @@ namespace garlic
if (!session->HandleNextMessage (buf, length, nullptr, 0))
{
// try to gererate more tags for last tagset
if (m_LastTagset && m_LastTagset->GetNextIndex () < 2*ECIESX25519_TAGSET_MAX_NUM_TAGS)
if (m_LastTagset && (m_LastTagset->GetNextIndex () - m_LastTagset->GetTrimBehind () < 3*ECIESX25519_MAX_NUM_GENERATED_TAGS))
{
auto maxTags = std::max (m_NumRatchetInboundTags, ECIESX25519_MAX_NUM_GENERATED_TAGS);
LogPrint (eLogWarning, "Garlic: trying to generate more ECIES-X25519-AEAD-Ratchet tags");

Loading…
Cancel
Save