mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 08:14:15 +00:00
send floodfill in DatabaseSerachReply
This commit is contained in:
parent
3961fdc2e1
commit
3d669c95d9
@ -160,14 +160,24 @@ namespace i2p
|
|||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
I2NPMessage * CreateDatabaseSearchReply (const i2p::data::IdentHash& ident)
|
I2NPMessage * CreateDatabaseSearchReply (const i2p::data::IdentHash& ident,
|
||||||
|
const i2p::data::RouterInfo * floodfill)
|
||||||
{
|
{
|
||||||
I2NPMessage * m = NewI2NPMessage ();
|
I2NPMessage * m = NewI2NPMessage ();
|
||||||
uint8_t * buf = m->GetPayload ();
|
uint8_t * buf = m->GetPayload ();
|
||||||
|
size_t len = 0;
|
||||||
memcpy (buf, ident, 32);
|
memcpy (buf, ident, 32);
|
||||||
buf[32] = 0; // TODO:
|
len += 32;
|
||||||
memcpy (buf + 33, i2p::context.GetRouterInfo ().GetIdentHash (), 32);
|
buf[len] = floodfill ? 1 : 0; // 1 router for now
|
||||||
m->len += 65;
|
len++;
|
||||||
|
if (floodfill)
|
||||||
|
{
|
||||||
|
memcpy (buf + len, floodfill->GetIdentHash (), 32);
|
||||||
|
len += 32;
|
||||||
|
}
|
||||||
|
memcpy (buf + len, i2p::context.GetRouterInfo ().GetIdentHash (), 32);
|
||||||
|
len += 32;
|
||||||
|
m->len += len;
|
||||||
FillI2NPMessageHeader (m, eI2NPDatabaseSearchReply);
|
FillI2NPMessageHeader (m, eI2NPDatabaseSearchReply);
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ namespace tunnel
|
|||||||
I2NPMessage * CreateDatabaseLookupMsg (const uint8_t * key, const uint8_t * from,
|
I2NPMessage * CreateDatabaseLookupMsg (const uint8_t * key, const uint8_t * from,
|
||||||
uint32_t replyTunnelID, bool exploratory = false,
|
uint32_t replyTunnelID, bool exploratory = false,
|
||||||
std::set<i2p::data::IdentHash> * excludedPeers = nullptr, bool encryption = false);
|
std::set<i2p::data::IdentHash> * excludedPeers = nullptr, bool encryption = false);
|
||||||
I2NPMessage * CreateDatabaseSearchReply (const i2p::data::IdentHash& ident);
|
I2NPMessage * CreateDatabaseSearchReply (const i2p::data::IdentHash& ident, const i2p::data::RouterInfo * floodfill);
|
||||||
|
|
||||||
I2NPMessage * CreateDatabaseStoreMsg (const i2p::data::RouterInfo * router = nullptr);
|
I2NPMessage * CreateDatabaseStoreMsg (const i2p::data::RouterInfo * router = nullptr);
|
||||||
|
|
||||||
|
@ -582,7 +582,10 @@ namespace data
|
|||||||
replyMsg = CreateDatabaseStoreMsg (router);
|
replyMsg = CreateDatabaseStoreMsg (router);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
replyMsg = CreateDatabaseSearchReply (buf);
|
{
|
||||||
|
std::set<IdentHash> excluded; // empty for now
|
||||||
|
replyMsg = CreateDatabaseSearchReply (buf, GetClosestFloodfill (buf, excluded));
|
||||||
|
}
|
||||||
if (replyMsg)
|
if (replyMsg)
|
||||||
{
|
{
|
||||||
if (replyTunnelID)
|
if (replyTunnelID)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user