1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-02-02 11:04:17 +00:00

don't flood to itself

This commit is contained in:
orignal 2016-06-30 10:21:53 -04:00
parent 28ab1230e2
commit ea1ba0f09b

View File

@ -488,11 +488,15 @@ namespace data
memcpy (payload + DATABASE_STORE_HEADER_SIZE, buf + payloadOffset, msgLen); memcpy (payload + DATABASE_STORE_HEADER_SIZE, buf + payloadOffset, msgLen);
floodMsg->FillI2NPMessageHeader (eI2NPDatabaseStore); floodMsg->FillI2NPMessageHeader (eI2NPDatabaseStore);
std::set<IdentHash> excluded; std::set<IdentHash> excluded;
for (int i = 0; i < 3; i++) excluded.insert (i2p::context.GetIdentHash ()); // don't flood to itself
for (int i = 0; i < 3; i++)
{ {
auto floodfill = GetClosestFloodfill (ident, excluded); auto floodfill = GetClosestFloodfill (ident, excluded);
if (floodfill) if (floodfill)
{
transports.SendMessage (floodfill->GetIdentHash (), floodMsg); transports.SendMessage (floodfill->GetIdentHash (), floodMsg);
excluded.insert (floodfill->GetIdentHash ());
}
else else
break; break;
} }