Browse Source

use shared flood message

pull/225/head
orignal 10 years ago
parent
commit
83e76c6b53
  1. 19
      NetDb.cpp

19
NetDb.cpp

@ -486,22 +486,19 @@ namespace data
if (context.IsFloodfill ()) if (context.IsFloodfill ())
{ {
// flood it // flood it
std::set<IdentHash> excluded; auto floodMsg = ToSharedI2NPMessage (NewI2NPShortMessage ());
for (int i = 0; i < 3; i++)
{
auto floodfill = GetClosestFloodfill (ident, excluded);
if (floodfill)
{
excluded.insert (floodfill->GetIdentHash ());
auto floodMsg = NewI2NPShortMessage ();
uint8_t * payload = floodMsg->GetPayload (); uint8_t * payload = floodMsg->GetPayload ();
memcpy (payload, buf, 33); // key + type memcpy (payload, buf, 33); // key + type
htobe32buf (payload + DATABASE_STORE_REPLY_TOKEN_OFFSET, 0); // zero reply token htobe32buf (payload + DATABASE_STORE_REPLY_TOKEN_OFFSET, 0); // zero reply token
memcpy (payload + DATABASE_STORE_HEADER_SIZE, buf + offset, len - offset); memcpy (payload + DATABASE_STORE_HEADER_SIZE, buf + offset, len - offset);
floodMsg->len += DATABASE_STORE_HEADER_SIZE + len -offset; floodMsg->len += DATABASE_STORE_HEADER_SIZE + len -offset;
FillI2NPMessageHeader (floodMsg, eI2NPDatabaseStore); FillI2NPMessageHeader (floodMsg.get (), eI2NPDatabaseStore); // TODO
transports.SendMessage (floodfill->GetIdentHash (), ToSharedI2NPMessage (floodMsg)); std::set<IdentHash> excluded;
} for (int i = 0; i < 3; i++)
{
auto floodfill = GetClosestFloodfill (ident, excluded);
if (floodfill)
transports.SendMessage (floodfill->GetIdentHash (), floodMsg);
} }
} }
} }

Loading…
Cancel
Save