mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-09 15:50:26 +03:00
drop unsolicited database serach replies
This commit is contained in:
parent
ba22a940f1
commit
a1eac6f28e
@ -991,15 +991,18 @@ namespace data
|
|||||||
auto dest = m_Requests.FindRequest (ident);
|
auto dest = m_Requests.FindRequest (ident);
|
||||||
if (dest)
|
if (dest)
|
||||||
{
|
{
|
||||||
if (num > 0 || dest->GetNumExcludedPeers () < 3) // before 3-rd attempt might be just bad luck
|
if (!dest->IsExploratory () && (num > 0 || dest->GetNumExcludedPeers () < 3)) // before 3-rd attempt might be just bad luck
|
||||||
// try to send next requests
|
// try to send next requests
|
||||||
m_Requests.SendNextRequest (dest);
|
m_Requests.SendNextRequest (dest);
|
||||||
else
|
else
|
||||||
// no more requests for destination possible. delete it
|
// no more requests for destination possible. delete it
|
||||||
m_Requests.RequestComplete (ident, nullptr);
|
m_Requests.RequestComplete (ident, nullptr);
|
||||||
}
|
}
|
||||||
else if(!m_FloodfillBootstrap)
|
else if (!m_FloodfillBootstrap)
|
||||||
LogPrint (eLogWarning, "NetDb: Requested destination for ", key, " not found");
|
{
|
||||||
|
LogPrint (eLogWarning, "NetDb: Unsolicited database search reply for ", key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// try responses
|
// try responses
|
||||||
for (int i = 0; i < num; i++)
|
for (int i = 0; i < num; i++)
|
||||||
|
@ -592,17 +592,6 @@ namespace tunnel
|
|||||||
auto typeID = msg->GetTypeID ();
|
auto typeID = msg->GetTypeID ();
|
||||||
LogPrint (eLogDebug, "Tunnel: Gateway of ", (int) len, " bytes for tunnel ", tunnel->GetTunnelID (), ", msg type ", (int)typeID);
|
LogPrint (eLogDebug, "Tunnel: Gateway of ", (int) len, " bytes for tunnel ", tunnel->GetTunnelID (), ", msg type ", (int)typeID);
|
||||||
|
|
||||||
if (typeID == eI2NPDatabaseSearchReply)
|
|
||||||
// DatabaseSearchReply with new routers
|
|
||||||
i2p::data::netdb.PostI2NPMsg (CopyI2NPMessage (msg));
|
|
||||||
else if (IsRouterInfoMsg (msg))
|
|
||||||
{
|
|
||||||
// transit DatabaseStore might contain new/updated RI
|
|
||||||
auto m = CopyI2NPMessage (msg);
|
|
||||||
if (bufbe32toh (m->GetPayload () + DATABASE_STORE_REPLY_TOKEN_OFFSET))
|
|
||||||
memset (m->GetPayload () + DATABASE_STORE_REPLY_TOKEN_OFFSET, 0xFF, 4); // fake replyToken meaning no reply
|
|
||||||
i2p::data::netdb.PostI2NPMsg (m);
|
|
||||||
}
|
|
||||||
tunnel->SendTunnelDataMsg (msg);
|
tunnel->SendTunnelDataMsg (msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user