From 50fa5eee2fa2743ac7669324b7cdeef4f421da68 Mon Sep 17 00:00:00 2001 From: orignal Date: Thu, 18 Sep 2025 18:21:10 -0400 Subject: [PATCH] limit send timer interval by pacing time --- libi2pd/Streaming.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libi2pd/Streaming.cpp b/libi2pd/Streaming.cpp index 25fb7b5d..ff349fb6 100644 --- a/libi2pd/Streaming.cpp +++ b/libi2pd/Streaming.cpp @@ -1533,13 +1533,14 @@ namespace stream if (m_Status != eStreamStatusTerminated) { m_SendTimer.cancel (); - m_SendTimer.expires_from_now (boost::posix_time::microseconds( - SEND_INTERVAL + m_LocalDestination.GetRandom () % SEND_INTERVAL_VARIANCE)); + uint64_t interval = SEND_INTERVAL + m_LocalDestination.GetRandom () % SEND_INTERVAL_VARIANCE; + if (interval < m_PacingTime) interval = m_PacingTime; + m_SendTimer.expires_from_now (boost::posix_time::microseconds(interval)); m_SendTimer.async_wait (std::bind (&Stream::HandleSendTimer, shared_from_this (), std::placeholders::_1)); } } - + void Stream::HandleSendTimer (const boost::system::error_code& ecode) { if (ecode != boost::asio::error::operation_aborted)