mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-10-17 09:10:21 +01:00
limit send timer interval by pacing time
This commit is contained in:
parent
241ac2f593
commit
50fa5eee2f
1 changed files with 4 additions and 3 deletions
|
@ -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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue