Browse Source

ability post LeaseSet update to destination's thread

pull/2108/head
orignal 6 days ago
parent
commit
bc9d25ec3b
  1. 7
      libi2pd/Destination.cpp
  2. 2
      libi2pd/Destination.h
  3. 2
      libi2pd/Garlic.cpp
  4. 2
      libi2pd/Garlic.h
  5. 2
      libi2pd/Tunnel.cpp

7
libi2pd/Destination.cpp

@ -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 ()

2
libi2pd/Destination.h

@ -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; };

2
libi2pd/Garlic.cpp

@ -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);

2
libi2pd/Garlic.h

@ -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;

2
libi2pd/Tunnel.cpp

@ -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);

Loading…
Cancel
Save