mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
mutex for request's excluded peers
This commit is contained in:
parent
146b3f52c0
commit
5f39f65540
@ -31,6 +31,7 @@ namespace data
|
|||||||
std::shared_ptr<I2NPMessage> RequestedDestination::CreateRequestMessage (std::shared_ptr<const RouterInfo> router,
|
std::shared_ptr<I2NPMessage> RequestedDestination::CreateRequestMessage (std::shared_ptr<const RouterInfo> router,
|
||||||
std::shared_ptr<const i2p::tunnel::InboundTunnel> replyTunnel)
|
std::shared_ptr<const i2p::tunnel::InboundTunnel> replyTunnel)
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> l (m_ExcludedPeerstMutex);
|
||||||
std::shared_ptr<I2NPMessage> msg;
|
std::shared_ptr<I2NPMessage> msg;
|
||||||
if(replyTunnel)
|
if(replyTunnel)
|
||||||
msg = i2p::CreateRouterInfoDatabaseLookupMsg (m_Destination,
|
msg = i2p::CreateRouterInfoDatabaseLookupMsg (m_Destination,
|
||||||
@ -53,8 +54,15 @@ namespace data
|
|||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RequestedDestination::IsExcluded (const IdentHash& ident) const
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> l (m_ExcludedPeerstMutex);
|
||||||
|
return m_ExcludedPeers.count (ident);
|
||||||
|
}
|
||||||
|
|
||||||
void RequestedDestination::ClearExcludedPeers ()
|
void RequestedDestination::ClearExcludedPeers ()
|
||||||
{
|
{
|
||||||
|
std::lock_guard<std::mutex> l (m_ExcludedPeerstMutex);
|
||||||
m_ExcludedPeers.clear ();
|
m_ExcludedPeers.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,12 +36,12 @@ namespace data
|
|||||||
|
|
||||||
const IdentHash& GetDestination () const { return m_Destination; };
|
const IdentHash& GetDestination () const { return m_Destination; };
|
||||||
int GetNumExcludedPeers () const { return m_ExcludedPeers.size (); };
|
int GetNumExcludedPeers () const { return m_ExcludedPeers.size (); };
|
||||||
const std::set<IdentHash>& GetExcludedPeers () { return m_ExcludedPeers; };
|
const std::set<IdentHash>& GetExcludedPeers () const { return m_ExcludedPeers; };
|
||||||
void ClearExcludedPeers ();
|
void ClearExcludedPeers ();
|
||||||
bool IsExploratory () const { return m_IsExploratory; };
|
bool IsExploratory () const { return m_IsExploratory; };
|
||||||
bool IsDirect () const { return m_IsDirect; };
|
bool IsDirect () const { return m_IsDirect; };
|
||||||
bool IsActive () const { return m_IsActive; };
|
bool IsActive () const { return m_IsActive; };
|
||||||
bool IsExcluded (const IdentHash& ident) const { return m_ExcludedPeers.count (ident); };
|
bool IsExcluded (const IdentHash& ident) const;
|
||||||
uint64_t GetCreationTime () const { return m_CreationTime; };
|
uint64_t GetCreationTime () const { return m_CreationTime; };
|
||||||
uint64_t GetLastRequestTime () const { return m_LastRequestTime; };
|
uint64_t GetLastRequestTime () const { return m_LastRequestTime; };
|
||||||
std::shared_ptr<I2NPMessage> CreateRequestMessage (std::shared_ptr<const RouterInfo>, std::shared_ptr<const i2p::tunnel::InboundTunnel> replyTunnel);
|
std::shared_ptr<I2NPMessage> CreateRequestMessage (std::shared_ptr<const RouterInfo>, std::shared_ptr<const i2p::tunnel::InboundTunnel> replyTunnel);
|
||||||
@ -57,6 +57,7 @@ namespace data
|
|||||||
|
|
||||||
IdentHash m_Destination;
|
IdentHash m_Destination;
|
||||||
bool m_IsExploratory, m_IsDirect, m_IsActive;
|
bool m_IsExploratory, m_IsDirect, m_IsActive;
|
||||||
|
mutable std::mutex m_ExcludedPeerstMutex;
|
||||||
std::set<IdentHash> m_ExcludedPeers;
|
std::set<IdentHash> m_ExcludedPeers;
|
||||||
uint64_t m_CreationTime, m_LastRequestTime; // in seconds
|
uint64_t m_CreationTime, m_LastRequestTime; // in seconds
|
||||||
RequestComplete m_RequestComplete;
|
RequestComplete m_RequestComplete;
|
||||||
|
Loading…
Reference in New Issue
Block a user