ability post LeaseSet update to destination's thread

This commit is contained in:
orignal 2024-10-17 16:20:27 -04:00
parent fe71776b6f
commit bc9d25ec3b
5 changed files with 9 additions and 6 deletions

View File

@ -588,8 +588,11 @@ namespace client
i2p::garlic::GarlicDestination::HandleDeliveryStatusMessage (msgID);
}
void LeaseSetDestination::SetLeaseSetUpdated ()
void LeaseSetDestination::SetLeaseSetUpdated (bool post)
{
if (post)
m_Service.post([s = shared_from_this ()]() { s->UpdateLeaseSet (); });
else
UpdateLeaseSet ();
}

View File

@ -150,7 +150,7 @@ namespace client
void SubmitECIESx25519Key (const uint8_t * key, uint64_t tag);
void ProcessGarlicMessage (std::shared_ptr<I2NPMessage> msg);
void ProcessDeliveryStatusMessage (std::shared_ptr<I2NPMessage> msg);
void SetLeaseSetUpdated ();
void SetLeaseSetUpdated (bool post) override;
bool IsPublic () const { return m_IsPublic; };
void SetPublic (bool pub) { m_IsPublic = pub; };

View File

@ -897,7 +897,7 @@ namespace garlic
}
}
void GarlicDestination::SetLeaseSetUpdated ()
void GarlicDestination::SetLeaseSetUpdated (bool post)
{
{
std::unique_lock<std::mutex> l(m_SessionsMutex);

View File

@ -253,7 +253,7 @@ namespace garlic
virtual void ProcessGarlicMessage (std::shared_ptr<I2NPMessage> msg);
virtual void ProcessDeliveryStatusMessage (std::shared_ptr<I2NPMessage> msg);
virtual void SetLeaseSetUpdated ();
virtual void SetLeaseSetUpdated (bool post = false);
virtual std::shared_ptr<const i2p::data::LocalLeaseSet> GetLeaseSet () = 0; // TODO
virtual std::shared_ptr<i2p::tunnel::TunnelPool> GetTunnelPool () const = 0;

View File

@ -259,7 +259,7 @@ namespace tunnel
{
// update LeaseSet
auto dest = pool->GetLocalDestination ();
if (dest) dest->SetLeaseSetUpdated ();
if (dest) dest->SetLeaseSetUpdated (true);
}
}
EncryptTunnelMsg (msg, msg);