limit send timer interval by pacing time

This commit is contained in:
orignal 2025-09-18 18:21:10 -04:00
parent 241ac2f593
commit 50fa5eee2f

View file

@ -1533,13 +1533,14 @@ namespace stream
if (m_Status != eStreamStatusTerminated) if (m_Status != eStreamStatusTerminated)
{ {
m_SendTimer.cancel (); m_SendTimer.cancel ();
m_SendTimer.expires_from_now (boost::posix_time::microseconds( uint64_t interval = SEND_INTERVAL + m_LocalDestination.GetRandom () % SEND_INTERVAL_VARIANCE;
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, m_SendTimer.async_wait (std::bind (&Stream::HandleSendTimer,
shared_from_this (), std::placeholders::_1)); shared_from_this (), std::placeholders::_1));
} }
} }
void Stream::HandleSendTimer (const boost::system::error_code& ecode) void Stream::HandleSendTimer (const boost::system::error_code& ecode)
{ {
if (ecode != boost::asio::error::operation_aborted) if (ecode != boost::asio::error::operation_aborted)