mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-23 17:36:37 +02:00
limit tunnel length to 8 hops
This commit is contained in:
parent
2bc0850b0f
commit
8f25b66760
2 changed files with 4 additions and 3 deletions
|
@ -42,8 +42,8 @@ namespace tunnel
|
||||||
void Tunnel::Build (uint32_t replyMsgID, std::shared_ptr<OutboundTunnel> outboundTunnel)
|
void Tunnel::Build (uint32_t replyMsgID, std::shared_ptr<OutboundTunnel> outboundTunnel)
|
||||||
{
|
{
|
||||||
auto numHops = m_Config->GetNumHops ();
|
auto numHops = m_Config->GetNumHops ();
|
||||||
int numRecords = numHops <= STANDARD_NUM_RECORDS ? STANDARD_NUM_RECORDS : numHops;
|
int numRecords = numHops <= STANDARD_NUM_RECORDS ? STANDARD_NUM_RECORDS : MAX_NUM_RECORDS;
|
||||||
auto msg = NewI2NPShortMessage ();
|
auto msg = numRecords <= STANDARD_NUM_RECORDS ? NewI2NPShortMessage () : NewI2NPMessage ();
|
||||||
*msg->GetPayload () = numRecords;
|
*msg->GetPayload () = numRecords;
|
||||||
msg->len += numRecords*TUNNEL_BUILD_RECORD_SIZE + 1;
|
msg->len += numRecords*TUNNEL_BUILD_RECORD_SIZE + 1;
|
||||||
// shuffle records
|
// shuffle records
|
||||||
|
|
|
@ -37,7 +37,8 @@ namespace tunnel
|
||||||
const int TUNNEL_RECREATION_THRESHOLD = 90; // 1.5 minutes
|
const int TUNNEL_RECREATION_THRESHOLD = 90; // 1.5 minutes
|
||||||
const int TUNNEL_CREATION_TIMEOUT = 30; // 30 seconds
|
const int TUNNEL_CREATION_TIMEOUT = 30; // 30 seconds
|
||||||
const int STANDARD_NUM_RECORDS = 4; // in VariableTunnelBuild message
|
const int STANDARD_NUM_RECORDS = 4; // in VariableTunnelBuild message
|
||||||
|
const int MAX_NUM_RECORDS = 8;
|
||||||
|
|
||||||
enum TunnelState
|
enum TunnelState
|
||||||
{
|
{
|
||||||
eTunnelStatePending,
|
eTunnelStatePending,
|
||||||
|
|
Loading…
Add table
Reference in a new issue