From 39e16824b96d7cc1f885a3f6cfa2038a37993499 Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 17 May 2024 19:19:17 -0400 Subject: [PATCH] reset routing path if duplicated SYN received --- libi2pd/Streaming.cpp | 11 +++++++++++ libi2pd/Streaming.h | 1 + 2 files changed, 12 insertions(+) diff --git a/libi2pd/Streaming.cpp b/libi2pd/Streaming.cpp index 13f8986b..a3a48f6b 100644 --- a/libi2pd/Streaming.cpp +++ b/libi2pd/Streaming.cpp @@ -1184,6 +1184,16 @@ namespace stream } } + void Stream::ResetRoutingPath () + { + m_CurrentOutboundTunnel = nullptr; + m_CurrentRemoteLease = nullptr; + m_RTT = INITIAL_RTT; + m_RTO = INITIAL_RTO; + if (m_RoutingSession) + m_RoutingSession->SetSharedRoutingPath (nullptr); // TODO: count failures + } + StreamingDestination::StreamingDestination (std::shared_ptr owner, uint16_t localPort, bool gzip): m_Owner (owner), m_LocalPort (localPort), m_Gzip (gzip), m_PendingIncomingTimer (m_Owner->GetService ()) @@ -1264,6 +1274,7 @@ namespace stream { // already pending LogPrint(eLogWarning, "Streaming: Incoming streaming with rSID=", receiveStreamID, " already exists"); + it1->second->ResetRoutingPath (); // Ack was not delivered, changing path DeletePacket (packet); // drop it, because previous should be connected return; } diff --git a/libi2pd/Streaming.h b/libi2pd/Streaming.h index e27deb9c..94a21240 100644 --- a/libi2pd/Streaming.h +++ b/libi2pd/Streaming.h @@ -180,6 +180,7 @@ namespace stream bool IsEstablished () const { return m_SendStreamID; }; StreamStatus GetStatus () const { return m_Status; }; StreamingDestination& GetLocalDestination () { return m_LocalDestination; }; + void ResetRoutingPath (); void HandleNextPacket (Packet * packet); void HandlePing (Packet * packet);