mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
don't send next request if requested destination is over
This commit is contained in:
parent
d3b699d7cd
commit
0ddc514221
@ -741,7 +741,7 @@ namespace data
|
||||
if (direct)
|
||||
{
|
||||
auto msg = dest->CreateRequestMessage (floodfill->GetIdentHash ());
|
||||
msg->onDrop = [this, dest]() { this->m_Requests.SendNextRequest (dest); };
|
||||
msg->onDrop = [this, dest]() { if (dest->IsActive ()) this->m_Requests.SendNextRequest (dest); };
|
||||
transports.SendMessage (floodfill->GetIdentHash (), msg);
|
||||
}
|
||||
else
|
||||
@ -752,7 +752,7 @@ namespace data
|
||||
if (outbound && inbound)
|
||||
{
|
||||
auto msg = dest->CreateRequestMessage (floodfill, inbound);
|
||||
msg->onDrop = [this, dest]() { this->m_Requests.SendNextRequest (dest); };
|
||||
msg->onDrop = [this, dest]() { if (dest->IsActive ()) this->m_Requests.SendNextRequest (dest); };
|
||||
outbound->SendTunnelDataMsgTo (floodfill->GetIdentHash (), 0,
|
||||
i2p::garlic::WrapECIESX25519MessageForRouter (msg, floodfill->GetIdentity ()->GetEncryptionPublicKey ()));
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace i2p
|
||||
namespace data
|
||||
{
|
||||
RequestedDestination::RequestedDestination (const IdentHash& destination, bool isExploratory, bool direct):
|
||||
m_Destination (destination), m_IsExploratory (isExploratory), m_IsDirect (direct),
|
||||
m_Destination (destination), m_IsExploratory (isExploratory), m_IsDirect (direct), m_IsActive (true),
|
||||
m_CreationTime (i2p::util::GetSecondsSinceEpoch ()), m_LastRequestTime (0)
|
||||
{
|
||||
}
|
||||
@ -60,6 +60,7 @@ namespace data
|
||||
|
||||
void RequestedDestination::Success (std::shared_ptr<RouterInfo> r)
|
||||
{
|
||||
m_IsActive = false;
|
||||
if (m_RequestComplete)
|
||||
{
|
||||
m_RequestComplete (r);
|
||||
@ -69,6 +70,7 @@ namespace data
|
||||
|
||||
void RequestedDestination::Fail ()
|
||||
{
|
||||
m_IsActive = false;
|
||||
if (m_RequestComplete)
|
||||
{
|
||||
m_RequestComplete (nullptr);
|
||||
@ -191,7 +193,7 @@ namespace data
|
||||
{
|
||||
LogPrint (eLogDebug, "NetDbReq: Try ", dest->GetDestination ().ToBase64 (), " at ", count, " floodfill ", nextFloodfill->GetIdentHash ().ToBase64 (), " directly");
|
||||
auto msg = dest->CreateRequestMessage (nextFloodfill->GetIdentHash ());
|
||||
msg->onDrop = [this, dest]() { this->SendNextRequest (dest); };
|
||||
msg->onDrop = [this, dest]() { if (dest->IsActive ()) this->SendNextRequest (dest); };
|
||||
i2p::transport::transports.SendMessage (nextFloodfill->GetIdentHash (), msg);
|
||||
}
|
||||
else
|
||||
@ -203,7 +205,7 @@ namespace data
|
||||
{
|
||||
LogPrint (eLogDebug, "NetDbReq: Try ", dest->GetDestination ().ToBase64 (), " at ", count, " floodfill ", nextFloodfill->GetIdentHash ().ToBase64 (), " through tunnels");
|
||||
auto msg = dest->CreateRequestMessage (nextFloodfill, inbound);
|
||||
msg->onDrop = [this, dest]() { this->SendNextRequest (dest); };
|
||||
msg->onDrop = [this, dest]() { if (dest->IsActive ()) this->SendNextRequest (dest); };
|
||||
outbound->SendTunnelDataMsgTo (nextFloodfill->GetIdentHash (), 0,
|
||||
i2p::garlic::WrapECIESX25519MessageForRouter (msg, nextFloodfill->GetIdentity ()->GetEncryptionPublicKey ()));
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ namespace data
|
||||
void ClearExcludedPeers ();
|
||||
bool IsExploratory () const { return m_IsExploratory; };
|
||||
bool IsDirect () const { return m_IsDirect; };
|
||||
bool IsActive () const { return m_IsActive; };
|
||||
bool IsExcluded (const IdentHash& ident) const { return m_ExcludedPeers.count (ident); };
|
||||
uint64_t GetCreationTime () const { return m_CreationTime; };
|
||||
uint64_t GetLastRequestTime () const { return m_LastRequestTime; };
|
||||
@ -55,7 +56,7 @@ namespace data
|
||||
private:
|
||||
|
||||
IdentHash m_Destination;
|
||||
bool m_IsExploratory, m_IsDirect;
|
||||
bool m_IsExploratory, m_IsDirect, m_IsActive;
|
||||
std::set<IdentHash> m_ExcludedPeers;
|
||||
uint64_t m_CreationTime, m_LastRequestTime; // in seconds
|
||||
RequestComplete m_RequestComplete;
|
||||
|
Loading…
Reference in New Issue
Block a user