|
|
@ -41,10 +41,11 @@ namespace tunnel |
|
|
|
const int MAX_NUM_RECORDS = 8; |
|
|
|
const int MAX_NUM_RECORDS = 8; |
|
|
|
const int HIGH_LATENCY_PER_HOP = 250; // in milliseconds
|
|
|
|
const int HIGH_LATENCY_PER_HOP = 250; // in milliseconds
|
|
|
|
const int MAX_TUNNEL_MSGS_BATCH_SIZE = 100; // handle messages without interrupt
|
|
|
|
const int MAX_TUNNEL_MSGS_BATCH_SIZE = 100; // handle messages without interrupt
|
|
|
|
|
|
|
|
const uint16_t DEFAULT_MAX_NUM_TRANSIT_TUNNELS = 5000; |
|
|
|
const int TUNNEL_MANAGE_INTERVAL = 15; // in seconds
|
|
|
|
const int TUNNEL_MANAGE_INTERVAL = 15; // in seconds
|
|
|
|
const int TUNNEL_POOLS_MANAGE_INTERVAL = 5; // in seconds
|
|
|
|
const int TUNNEL_POOLS_MANAGE_INTERVAL = 5; // in seconds
|
|
|
|
const int TUNNEL_MEMORY_POOL_MANAGE_INTERVAL = 120; // in seconds
|
|
|
|
const int TUNNEL_MEMORY_POOL_MANAGE_INTERVAL = 120; // in seconds
|
|
|
|
|
|
|
|
|
|
|
|
const size_t I2NP_TUNNEL_MESSAGE_SIZE = TUNNEL_DATA_MSG_SIZE + I2NP_HEADER_SIZE + 34; // reserved for alignment and NTCP 16 + 6 + 12
|
|
|
|
const size_t I2NP_TUNNEL_MESSAGE_SIZE = TUNNEL_DATA_MSG_SIZE + I2NP_HEADER_SIZE + 34; // reserved for alignment and NTCP 16 + 6 + 12
|
|
|
|
const size_t I2NP_TUNNEL_ENPOINT_MESSAGE_SIZE = 2*TUNNEL_DATA_MSG_SIZE + I2NP_HEADER_SIZE + TUNNEL_GATEWAY_HEADER_SIZE + 28; // reserved for alignment and NTCP 16 + 6 + 6
|
|
|
|
const size_t I2NP_TUNNEL_ENPOINT_MESSAGE_SIZE = 2*TUNNEL_DATA_MSG_SIZE + I2NP_HEADER_SIZE + TUNNEL_GATEWAY_HEADER_SIZE + 28; // reserved for alignment and NTCP 16 + 6 + 6
|
|
|
|
|
|
|
|
|
|
|
@ -229,6 +230,10 @@ namespace tunnel |
|
|
|
|
|
|
|
|
|
|
|
std::shared_ptr<I2NPMessage> NewI2NPTunnelMessage (bool endpoint); |
|
|
|
std::shared_ptr<I2NPMessage> NewI2NPTunnelMessage (bool endpoint); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SetMaxNumTransitTunnels (uint16_t maxNumTransitTunnels); |
|
|
|
|
|
|
|
uint16_t GetMaxNumTransitTunnels () const { return m_MaxNumTransitTunnels; }; |
|
|
|
|
|
|
|
bool IsTooManyTransitTunnels () const { return m_TransitTunnels.size () >= m_MaxNumTransitTunnels; }; |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|
|
|
|
|
|
|
|
|
template<class TTunnel> |
|
|
|
template<class TTunnel> |
|
|
@ -287,6 +292,7 @@ namespace tunnel |
|
|
|
i2p::util::Queue<std::shared_ptr<I2NPMessage> > m_Queue; |
|
|
|
i2p::util::Queue<std::shared_ptr<I2NPMessage> > m_Queue; |
|
|
|
i2p::util::MemoryPoolMt<I2NPMessageBuffer<I2NP_TUNNEL_ENPOINT_MESSAGE_SIZE> > m_I2NPTunnelEndpointMessagesMemoryPool; |
|
|
|
i2p::util::MemoryPoolMt<I2NPMessageBuffer<I2NP_TUNNEL_ENPOINT_MESSAGE_SIZE> > m_I2NPTunnelEndpointMessagesMemoryPool; |
|
|
|
i2p::util::MemoryPoolMt<I2NPMessageBuffer<I2NP_TUNNEL_MESSAGE_SIZE> > m_I2NPTunnelMessagesMemoryPool; |
|
|
|
i2p::util::MemoryPoolMt<I2NPMessageBuffer<I2NP_TUNNEL_MESSAGE_SIZE> > m_I2NPTunnelMessagesMemoryPool; |
|
|
|
|
|
|
|
uint16_t m_MaxNumTransitTunnels; |
|
|
|
// count of tunnels for total TCSR algorithm
|
|
|
|
// count of tunnels for total TCSR algorithm
|
|
|
|
int m_TotalNumSuccesiveTunnelCreations, m_TotalNumFailedTunnelCreations; |
|
|
|
int m_TotalNumSuccesiveTunnelCreations, m_TotalNumFailedTunnelCreations; |
|
|
|
double m_TunnelCreationSuccessRate; |
|
|
|
double m_TunnelCreationSuccessRate; |
|
|
|