mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-24 10:14:13 +00:00
received garlic messages queue for destination
This commit is contained in:
parent
ce0461bf86
commit
3c608ec07c
@ -347,7 +347,24 @@ namespace client
|
|||||||
|
|
||||||
void LeaseSetDestination::ProcessGarlicMessage (std::shared_ptr<I2NPMessage> msg)
|
void LeaseSetDestination::ProcessGarlicMessage (std::shared_ptr<I2NPMessage> msg)
|
||||||
{
|
{
|
||||||
m_Service.post (std::bind (&LeaseSetDestination::HandleGarlicMessage, shared_from_this (), msg));
|
if (!msg) return;
|
||||||
|
bool empty = false;
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> l(m_IncomingMsgsQueueMutex);
|
||||||
|
empty = m_IncomingMsgsQueue.empty ();
|
||||||
|
m_IncomingMsgsQueue.push_back (msg);
|
||||||
|
}
|
||||||
|
if (empty)
|
||||||
|
m_Service.post([s = shared_from_this ()]()
|
||||||
|
{
|
||||||
|
std::list<std::shared_ptr<I2NPMessage> > receivedMsgs;
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> l(s->m_IncomingMsgsQueueMutex);
|
||||||
|
s->m_IncomingMsgsQueue.swap (receivedMsgs);
|
||||||
|
}
|
||||||
|
for (auto& it: receivedMsgs)
|
||||||
|
s->HandleGarlicMessage (it);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void LeaseSetDestination::ProcessDeliveryStatusMessage (std::shared_ptr<I2NPMessage> msg)
|
void LeaseSetDestination::ProcessDeliveryStatusMessage (std::shared_ptr<I2NPMessage> msg)
|
||||||
|
@ -200,6 +200,9 @@ namespace client
|
|||||||
std::unordered_map<i2p::data::IdentHash, std::shared_ptr<i2p::data::LeaseSet> > m_RemoteLeaseSets;
|
std::unordered_map<i2p::data::IdentHash, std::shared_ptr<i2p::data::LeaseSet> > m_RemoteLeaseSets;
|
||||||
std::unordered_map<i2p::data::IdentHash, std::shared_ptr<LeaseSetRequest> > m_LeaseSetRequests;
|
std::unordered_map<i2p::data::IdentHash, std::shared_ptr<LeaseSetRequest> > m_LeaseSetRequests;
|
||||||
|
|
||||||
|
std::list<std::shared_ptr<I2NPMessage> > m_IncomingMsgsQueue;
|
||||||
|
mutable std::mutex m_IncomingMsgsQueueMutex;
|
||||||
|
|
||||||
std::shared_ptr<i2p::tunnel::TunnelPool> m_Pool;
|
std::shared_ptr<i2p::tunnel::TunnelPool> m_Pool;
|
||||||
std::mutex m_LeaseSetMutex;
|
std::mutex m_LeaseSetMutex;
|
||||||
std::shared_ptr<const i2p::data::LocalLeaseSet> m_LeaseSet;
|
std::shared_ptr<const i2p::data::LocalLeaseSet> m_LeaseSet;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user