From 9b181c391f6568c08efbb061dab84253058f17b3 Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 10 Nov 2025 20:28:22 -0500 Subject: [PATCH] create new stream only if bandwidth is available. Close non-responding streams --- libi2pd/Streaming.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/libi2pd/Streaming.cpp b/libi2pd/Streaming.cpp index ff349fb6..1e8249bd 100644 --- a/libi2pd/Streaming.cpp +++ b/libi2pd/Streaming.cpp @@ -919,6 +919,14 @@ namespace stream } else if (numMsgs > m_NumPacketsToSend) numMsgs = m_NumPacketsToSend; + + if (!m_RemoteLeaseSet) m_RemoteLeaseSet = m_LocalDestination.GetOwner ()->FindLeaseSet (m_RemoteIdentity->GetIdentHash ()); + if (m_RemoteLeaseSet) + { + if (!m_RoutingSession) + m_RoutingSession = m_LocalDestination.GetOwner ()->GetRoutingSession (m_RemoteLeaseSet, true, false); + } + if (m_RoutingSession) { m_IsJavaClient = m_RoutingSession->IsWithJava (); @@ -1759,6 +1767,7 @@ namespace stream ", another remote lease has been selected for stream with rSID=", m_RecvStreamID, ", sSID=", m_SendStreamID); } } + if (m_IsTimeOutResend) ScheduleResend (); SendPackets (packets); m_LastSendTime = ts; m_IsSendTime = false; @@ -1804,6 +1813,17 @@ namespace stream m_CurrentRemoteLease = nullptr; } } + if (m_LastReceivedSequenceNumber == 0 && m_SequenceNumber == 1) + { + if (m_NumResendAttempts > 1) + { + m_Status = eStreamStatusReset; + Close (); + return; + } + m_NumResendAttempts++; + ScheduleAck (INITIAL_RTO); + } SendQuickAck (); } m_IsAckSendScheduled = false;