mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 03:37:49 +02:00
handle NTCP2 RouterInfo flag
This commit is contained in:
parent
0e9074aaba
commit
42ed312384
4 changed files with 19 additions and 5 deletions
|
@ -12,6 +12,7 @@
|
|||
#include "I2NPProtocol.h"
|
||||
#include "Tunnel.h"
|
||||
#include "Transports.h"
|
||||
#include "NTCP2.h"
|
||||
#include "RouterContext.h"
|
||||
#include "Garlic.h"
|
||||
#include "NetDb.hpp"
|
||||
|
@ -99,8 +100,8 @@ namespace data
|
|||
HandleDatabaseLookupMsg (msg);
|
||||
break;
|
||||
case eI2NPDummyMsg:
|
||||
// plain RouterInfo from NTCP2 for now
|
||||
AddRouterInfo (msg->GetPayload (), msg->GetPayloadLength ());
|
||||
// plain RouterInfo from NTCP2 with flag for now
|
||||
HandleNTCP2RouterInfoMsg (msg);
|
||||
break;
|
||||
default: // WTF?
|
||||
LogPrint (eLogError, "NetDb: unexpected message type ", (int) msg->GetTypeID ());
|
||||
|
@ -574,6 +575,16 @@ namespace data
|
|||
transports.SendMessage (from, dest->CreateRequestMessage (nullptr, nullptr));
|
||||
}
|
||||
|
||||
void NetDb::HandleNTCP2RouterInfoMsg (std::shared_ptr<const I2NPMessage> m)
|
||||
{
|
||||
uint8_t flood = m->GetPayload ()[0] & NTCP2_ROUTER_INFO_FLAG_REQUEST_FLOOD;
|
||||
bool updated = AddRouterInfo (m->GetPayload () + 1, m->GetPayloadLength () - 1); // without flag
|
||||
if (flood && updated && context.IsFloodfill ())
|
||||
{
|
||||
// TODO: flood
|
||||
LogPrint (eLogInfo, "NetDb: NTCP RouterInfo flood is not implemented");
|
||||
}
|
||||
}
|
||||
|
||||
void NetDb::HandleDatabaseStoreMsg (std::shared_ptr<const I2NPMessage> m)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue