From 345be142ae841f80ee041563a0a8cdbfebcc57d0 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 19 Feb 2014 22:08:57 -0500 Subject: [PATCH] always pass delivery instructions to tunnel gateway --- NTCPSession.h | 2 +- TransitTunnel.cpp | 5 ++++- Tunnel.cpp | 17 ++++++++++++++++- TunnelGateway.cpp | 25 ------------------------- TunnelGateway.h | 2 -- 5 files changed, 21 insertions(+), 30 deletions(-) diff --git a/NTCPSession.h b/NTCPSession.h index 0976581d..eb31951d 100644 --- a/NTCPSession.h +++ b/NTCPSession.h @@ -60,7 +60,7 @@ namespace ntcp #pragma pack() - const int TERMINATION_TIMEOUT = 150; // 2.5 minutes + const int TERMINATION_TIMEOUT = 120; // 2 minutes class NTCPSession { public: diff --git a/TransitTunnel.cpp b/TransitTunnel.cpp index 2435cbe5..a96f3d05 100644 --- a/TransitTunnel.cpp +++ b/TransitTunnel.cpp @@ -55,7 +55,10 @@ namespace tunnel void TransitTunnelGateway::SendTunnelDataMsg (i2p::I2NPMessage * msg) { - m_Gateway.SendTunnelDataMsg (msg); + TunnelMessageBlock block; + block.deliveryType = eDeliveryTypeLocal; + block.data = msg; + m_Gateway.SendTunnelDataMsg (block); } void TransitTunnelEndpoint::HandleTunnelDataMsg (i2p::I2NPMessage * tunnelMsg) diff --git a/Tunnel.cpp b/Tunnel.cpp index 88ab9534..9d58c875 100644 --- a/Tunnel.cpp +++ b/Tunnel.cpp @@ -136,7 +136,22 @@ namespace tunnel void OutboundTunnel::SendTunnelDataMsg (const uint8_t * gwHash, uint32_t gwTunnel, i2p::I2NPMessage * msg) { - m_Gateway.SendTunnelDataMsg (gwHash, gwTunnel, msg); + TunnelMessageBlock block; + if (gwHash) + { + block.hash = gwHash; + if (gwTunnel) + { + block.deliveryType = eDeliveryTypeTunnel; + block.tunnelID = gwTunnel; + } + else + block.deliveryType = eDeliveryTypeRouter; + } + else + block.deliveryType = eDeliveryTypeLocal; + block.data = msg; + m_Gateway.SendTunnelDataMsg (block); } void OutboundTunnel::SendTunnelDataMsg (std::vector msgs) diff --git a/TunnelGateway.cpp b/TunnelGateway.cpp index 50eb1c7f..cc1189e0 100644 --- a/TunnelGateway.cpp +++ b/TunnelGateway.cpp @@ -148,31 +148,6 @@ namespace tunnel m_TunnelDataMsgs.push_back (m_CurrentTunnelDataMsg); m_CurrentTunnelDataMsg = nullptr; } - - void TunnelGateway::SendTunnelDataMsg (i2p::I2NPMessage * msg) - { - SendTunnelDataMsg (nullptr, 0, msg); - } - - void TunnelGateway::SendTunnelDataMsg (const uint8_t * gwHash, uint32_t gwTunnel, i2p::I2NPMessage * msg) - { - TunnelMessageBlock block; - if (gwHash) - { - block.hash = gwHash; - if (gwTunnel) - { - block.deliveryType = eDeliveryTypeTunnel; - block.tunnelID = gwTunnel; - } - else - block.deliveryType = eDeliveryTypeRouter; - } - else - block.deliveryType = eDeliveryTypeLocal; - block.data = msg; - SendTunnelDataMsg (block); - } void TunnelGateway::SendTunnelDataMsg (const TunnelMessageBlock& block) { diff --git a/TunnelGateway.h b/TunnelGateway.h index 6226c8ec..8c390eef 100644 --- a/TunnelGateway.h +++ b/TunnelGateway.h @@ -37,8 +37,6 @@ namespace tunnel TunnelGateway (TunnelBase * tunnel): m_Tunnel (tunnel), m_Buffer (tunnel->GetNextTunnelID ()), m_NumSentBytes (0) {}; - void SendTunnelDataMsg (i2p::I2NPMessage * msg); - void SendTunnelDataMsg (const uint8_t * gwHash, uint32_t gwTunnel, i2p::I2NPMessage * msg); void SendTunnelDataMsg (const TunnelMessageBlock& block); void PutTunnelDataMsg (const TunnelMessageBlock& block); void SendBuffer ();