mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-23 17:36:37 +02:00
use shared flood message
This commit is contained in:
parent
adf12b6084
commit
83e76c6b53
1 changed files with 8 additions and 11 deletions
19
NetDb.cpp
19
NetDb.cpp
|
@ -486,22 +486,19 @@ namespace data
|
||||||
if (context.IsFloodfill ())
|
if (context.IsFloodfill ())
|
||||||
{
|
{
|
||||||
// flood it
|
// flood it
|
||||||
|
auto floodMsg = ToSharedI2NPMessage (NewI2NPShortMessage ());
|
||||||
|
uint8_t * payload = floodMsg->GetPayload ();
|
||||||
|
memcpy (payload, buf, 33); // key + type
|
||||||
|
htobe32buf (payload + DATABASE_STORE_REPLY_TOKEN_OFFSET, 0); // zero reply token
|
||||||
|
memcpy (payload + DATABASE_STORE_HEADER_SIZE, buf + offset, len - offset);
|
||||||
|
floodMsg->len += DATABASE_STORE_HEADER_SIZE + len -offset;
|
||||||
|
FillI2NPMessageHeader (floodMsg.get (), eI2NPDatabaseStore); // TODO
|
||||||
std::set<IdentHash> excluded;
|
std::set<IdentHash> excluded;
|
||||||
for (int i = 0; i < 3; i++)
|
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);
|
||||||
excluded.insert (floodfill->GetIdentHash ());
|
|
||||||
auto floodMsg = NewI2NPShortMessage ();
|
|
||||||
uint8_t * payload = floodMsg->GetPayload ();
|
|
||||||
memcpy (payload, buf, 33); // key + type
|
|
||||||
htobe32buf (payload + DATABASE_STORE_REPLY_TOKEN_OFFSET, 0); // zero reply token
|
|
||||||
memcpy (payload + DATABASE_STORE_HEADER_SIZE, buf + offset, len - offset);
|
|
||||||
floodMsg->len += DATABASE_STORE_HEADER_SIZE + len -offset;
|
|
||||||
FillI2NPMessageHeader (floodMsg, eI2NPDatabaseStore);
|
|
||||||
transports.SendMessage (floodfill->GetIdentHash (), ToSharedI2NPMessage (floodMsg));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue