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,9 +588,12 @@ namespace client
i2p::garlic::GarlicDestination::HandleDeliveryStatusMessage (msgID); i2p::garlic::GarlicDestination::HandleDeliveryStatusMessage (msgID);
} }
void LeaseSetDestination::SetLeaseSetUpdated () void LeaseSetDestination::SetLeaseSetUpdated (bool post)
{ {
UpdateLeaseSet (); if (post)
m_Service.post([s = shared_from_this ()]() { s->UpdateLeaseSet (); });
else
UpdateLeaseSet ();
} }
void LeaseSetDestination::Publish () void LeaseSetDestination::Publish ()

View File

@ -150,7 +150,7 @@ namespace client
void SubmitECIESx25519Key (const uint8_t * key, uint64_t tag); void SubmitECIESx25519Key (const uint8_t * key, uint64_t tag);
void ProcessGarlicMessage (std::shared_ptr<I2NPMessage> msg); void ProcessGarlicMessage (std::shared_ptr<I2NPMessage> msg);
void ProcessDeliveryStatusMessage (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; }; bool IsPublic () const { return m_IsPublic; };
void SetPublic (bool pub) { m_IsPublic = pub; }; 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); 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 ProcessGarlicMessage (std::shared_ptr<I2NPMessage> msg);
virtual void ProcessDeliveryStatusMessage (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<const i2p::data::LocalLeaseSet> GetLeaseSet () = 0; // TODO
virtual std::shared_ptr<i2p::tunnel::TunnelPool> GetTunnelPool () const = 0; virtual std::shared_ptr<i2p::tunnel::TunnelPool> GetTunnelPool () const = 0;

View File

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