From 99ed95c7ebd202fe9ac1fd2fec6e313ce379f979 Mon Sep 17 00:00:00 2001 From: orignal Date: Wed, 3 Dec 2025 15:07:30 -0500 Subject: [PATCH] Request ack more often --- libi2pd/Streaming.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/libi2pd/Streaming.cpp b/libi2pd/Streaming.cpp index fa9b2d8a..58015bc0 100644 --- a/libi2pd/Streaming.cpp +++ b/libi2pd/Streaming.cpp @@ -622,8 +622,22 @@ namespace stream LogPrint (eLogError, "Streaming: Missing signature, sSID=", m_SendStreamID, ", rSID=", m_RecvStreamID); return false; } - if (immediateAckRequested) - SendQuickAck (); + if (immediateAckRequested) + { + auto ts = i2p::util::GetMillisecondsSinceEpoch (); + if (m_LastACKSendTime != ts) // preventing multiple acks when reading m_SavedPackets + { + if (m_IsAckSendScheduled) + { + SendQuickAck (); + auto ackTimeout = m_RTT/10; + if (ackTimeout > m_AckDelay) ackTimeout = m_AckDelay; + ScheduleAck (ackTimeout); + } + else + SendQuickAck (); + } + } return true; } @@ -1039,7 +1053,7 @@ namespace stream else { // follow on packet - if (m_IsJavaClient && (!m_LastACKRequestTime || ts - m_LastACKRequestTime > m_MinRTT / 10)) + if (!m_LastACKRequestTime || ts - m_LastACKRequestTime > m_MinRTT / 10) { m_LastACKRequestTime = ts; htobe16buf (packet + size, PACKET_FLAG_DELAY_REQUESTED);