mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
removed non longer used mutex
This commit is contained in:
parent
e74272781f
commit
f4ea6138e8
@ -35,7 +35,6 @@ 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_ExcludedPeersMutex);
|
|
||||||
std::shared_ptr<I2NPMessage> msg;
|
std::shared_ptr<I2NPMessage> msg;
|
||||||
if(replyTunnel)
|
if(replyTunnel)
|
||||||
msg = i2p::CreateRouterInfoDatabaseLookupMsg (m_Destination,
|
msg = i2p::CreateRouterInfoDatabaseLookupMsg (m_Destination,
|
||||||
@ -52,7 +51,6 @@ namespace data
|
|||||||
|
|
||||||
std::shared_ptr<I2NPMessage> RequestedDestination::CreateRequestMessage (const IdentHash& floodfill)
|
std::shared_ptr<I2NPMessage> RequestedDestination::CreateRequestMessage (const IdentHash& floodfill)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> l (m_ExcludedPeersMutex);
|
|
||||||
auto msg = i2p::CreateRouterInfoDatabaseLookupMsg (m_Destination,
|
auto msg = i2p::CreateRouterInfoDatabaseLookupMsg (m_Destination,
|
||||||
i2p::context.GetRouterInfo ().GetIdentHash () , 0, false, &m_ExcludedPeers);
|
i2p::context.GetRouterInfo ().GetIdentHash () , 0, false, &m_ExcludedPeers);
|
||||||
m_ExcludedPeers.insert (floodfill);
|
m_ExcludedPeers.insert (floodfill);
|
||||||
@ -63,21 +61,13 @@ namespace data
|
|||||||
|
|
||||||
bool RequestedDestination::IsExcluded (const IdentHash& ident) const
|
bool RequestedDestination::IsExcluded (const IdentHash& ident) const
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> l (m_ExcludedPeersMutex);
|
|
||||||
return m_ExcludedPeers.count (ident);
|
return m_ExcludedPeers.count (ident);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RequestedDestination::ClearExcludedPeers ()
|
void RequestedDestination::ClearExcludedPeers ()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> l (m_ExcludedPeersMutex);
|
|
||||||
m_ExcludedPeers.clear ();
|
m_ExcludedPeers.clear ();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unordered_set<IdentHash> RequestedDestination::GetExcludedPeers () const
|
|
||||||
{
|
|
||||||
std::lock_guard<std::mutex> l (m_ExcludedPeersMutex);
|
|
||||||
return m_ExcludedPeers;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RequestedDestination::Success (std::shared_ptr<RouterInfo> r)
|
void RequestedDestination::Success (std::shared_ptr<RouterInfo> r)
|
||||||
{
|
{
|
||||||
|
@ -41,7 +41,7 @@ namespace data
|
|||||||
~RequestedDestination ();
|
~RequestedDestination ();
|
||||||
|
|
||||||
const IdentHash& GetDestination () const { return m_Destination; };
|
const IdentHash& GetDestination () const { return m_Destination; };
|
||||||
std::unordered_set<IdentHash> GetExcludedPeers () const;
|
const std::unordered_set<IdentHash>& GetExcludedPeers () const { return m_ExcludedPeers; };
|
||||||
int GetNumAttempts () const { return m_NumAttempts; };
|
int GetNumAttempts () const { return m_NumAttempts; };
|
||||||
void ClearExcludedPeers ();
|
void ClearExcludedPeers ();
|
||||||
bool IsExploratory () const { return m_IsExploratory; };
|
bool IsExploratory () const { return m_IsExploratory; };
|
||||||
@ -63,7 +63,6 @@ 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_ExcludedPeersMutex;
|
|
||||||
std::unordered_set<IdentHash> m_ExcludedPeers;
|
std::unordered_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;
|
||||||
@ -84,14 +83,14 @@ namespace data
|
|||||||
std::shared_ptr<RequestedDestination> CreateRequest (const IdentHash& destination, bool isExploratory,
|
std::shared_ptr<RequestedDestination> CreateRequest (const IdentHash& destination, bool isExploratory,
|
||||||
bool direct = false, RequestedDestination::RequestComplete requestComplete = nullptr);
|
bool direct = false, RequestedDestination::RequestComplete requestComplete = nullptr);
|
||||||
void RequestComplete (const IdentHash& ident, std::shared_ptr<RouterInfo> r);
|
void RequestComplete (const IdentHash& ident, std::shared_ptr<RouterInfo> r);
|
||||||
std::shared_ptr<RequestedDestination> FindRequest (const IdentHash& ident) const;
|
|
||||||
bool SendNextRequest (std::shared_ptr<RequestedDestination> dest);
|
|
||||||
|
|
||||||
void PostDatabaseSearchReplyMsg (std::shared_ptr<const I2NPMessage> msg);
|
void PostDatabaseSearchReplyMsg (std::shared_ptr<const I2NPMessage> msg);
|
||||||
void PostRequestDestination (const IdentHash& destination, const RequestedDestination::RequestComplete& requestComplete, bool direct);
|
void PostRequestDestination (const IdentHash& destination, const RequestedDestination::RequestComplete& requestComplete, bool direct);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
std::shared_ptr<RequestedDestination> FindRequest (const IdentHash& ident) const;
|
||||||
|
bool SendNextRequest (std::shared_ptr<RequestedDestination> dest);
|
||||||
|
|
||||||
void HandleDatabaseSearchReplyMsg (std::shared_ptr<const I2NPMessage> msg);
|
void HandleDatabaseSearchReplyMsg (std::shared_ptr<const I2NPMessage> msg);
|
||||||
void RequestDestination (const IdentHash& destination, const RequestedDestination::RequestComplete& requestComplete, bool direct);
|
void RequestDestination (const IdentHash& destination, const RequestedDestination::RequestComplete& requestComplete, bool direct);
|
||||||
void Explore (int numDestinations);
|
void Explore (int numDestinations);
|
||||||
|
Loading…
Reference in New Issue
Block a user