mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
fixed race condition
This commit is contained in:
parent
09298d7457
commit
0e8bdf8299
|
@ -299,6 +299,18 @@ namespace i2p
|
||||||
i2p::HandleI2NPMessage (CreateI2NPMessage (buf, GetI2NPMessageLength (buf), from));
|
i2p::HandleI2NPMessage (CreateI2NPMessage (buf, GetI2NPMessageLength (buf), from));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RouterContext::ProcessGarlicMessage (I2NPMessage * msg)
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> l(m_GarlicMutex);
|
||||||
|
i2p::garlic::GarlicDestination::ProcessGarlicMessage (msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RouterContext::ProcessDeliveryStatusMessage (I2NPMessage * msg)
|
||||||
|
{
|
||||||
|
std::unique_lock<std::mutex> l(m_GarlicMutex);
|
||||||
|
i2p::garlic::GarlicDestination::ProcessDeliveryStatusMessage (msg);
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t RouterContext::GetUptime () const
|
uint32_t RouterContext::GetUptime () const
|
||||||
{
|
{
|
||||||
return i2p::util::GetSecondsSinceEpoch () - m_StartupTime;
|
return i2p::util::GetSecondsSinceEpoch () - m_StartupTime;
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <mutex>
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
#include <cryptopp/dsa.h>
|
#include <cryptopp/dsa.h>
|
||||||
#include <cryptopp/osrng.h>
|
#include <cryptopp/osrng.h>
|
||||||
|
@ -75,6 +76,10 @@ namespace i2p
|
||||||
std::shared_ptr<const i2p::data::LeaseSet> GetLeaseSet () { return nullptr; };
|
std::shared_ptr<const i2p::data::LeaseSet> GetLeaseSet () { return nullptr; };
|
||||||
std::shared_ptr<i2p::tunnel::TunnelPool> GetTunnelPool () const;
|
std::shared_ptr<i2p::tunnel::TunnelPool> GetTunnelPool () const;
|
||||||
void HandleI2NPMessage (const uint8_t * buf, size_t len, std::shared_ptr<i2p::tunnel::InboundTunnel> from);
|
void HandleI2NPMessage (const uint8_t * buf, size_t len, std::shared_ptr<i2p::tunnel::InboundTunnel> from);
|
||||||
|
|
||||||
|
// override GarlicDestination
|
||||||
|
void ProcessGarlicMessage (I2NPMessage * msg);
|
||||||
|
void ProcessDeliveryStatusMessage (I2NPMessage * msg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -93,6 +98,7 @@ namespace i2p
|
||||||
bool m_AcceptsTunnels, m_IsFloodfill;
|
bool m_AcceptsTunnels, m_IsFloodfill;
|
||||||
uint64_t m_StartupTime; // in seconds since epoch
|
uint64_t m_StartupTime; // in seconds since epoch
|
||||||
RouterStatus m_Status;
|
RouterStatus m_Status;
|
||||||
|
std::mutex m_GarlicMutex;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern RouterContext context;
|
extern RouterContext context;
|
||||||
|
|
Loading…
Reference in a new issue