mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-02 11:04:00 +01:00
Compare commits
2 commits
f611136ea7
...
7461b640e3
Author | SHA1 | Date | |
---|---|---|---|
7461b640e3 | |||
743126b2ad |
|
@ -42,8 +42,8 @@ namespace transport
|
||||||
const int SSU2_KEEP_ALIVE_INTERVAL = 15; // in seconds
|
const int SSU2_KEEP_ALIVE_INTERVAL = 15; // in seconds
|
||||||
const int SSU2_KEEP_ALIVE_INTERVAL_VARIANCE = 4; // in seconds
|
const int SSU2_KEEP_ALIVE_INTERVAL_VARIANCE = 4; // in seconds
|
||||||
const int SSU2_PROXY_CONNECT_RETRY_TIMEOUT = 30; // in seconds
|
const int SSU2_PROXY_CONNECT_RETRY_TIMEOUT = 30; // in seconds
|
||||||
const int SSU2_MIN_HOLE_PUNCH_EXPIRATION = 45; // in seconds
|
const int SSU2_MIN_HOLE_PUNCH_EXPIRATION = 30; // in seconds
|
||||||
const int SSU2_MAX_HOLE_PUNCH_EXPIRATION = 181; // in seconds
|
const int SSU2_MAX_HOLE_PUNCH_EXPIRATION = 160; // in seconds
|
||||||
const size_t SSU2_MAX_NUM_PACKETS_PER_BATCH = 64;
|
const size_t SSU2_MAX_NUM_PACKETS_PER_BATCH = 64;
|
||||||
|
|
||||||
class SSU2Server: private i2p::util::RunnableServiceWithWork
|
class SSU2Server: private i2p::util::RunnableServiceWithWork
|
||||||
|
|
|
@ -1237,7 +1237,8 @@ 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(SEND_INTERVAL));
|
m_SendTimer.expires_from_now (boost::posix_time::microseconds(
|
||||||
|
SEND_INTERVAL + m_LocalDestination.GetRandom () % SEND_INTERVAL_VARIANCE));
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
@ -1250,8 +1251,17 @@ namespace stream
|
||||||
auto ts = i2p::util::GetMillisecondsSinceEpoch ();
|
auto ts = i2p::util::GetMillisecondsSinceEpoch ();
|
||||||
if (m_LastSendTime && ts*1000 > m_LastSendTime*1000 + m_PacingTime)
|
if (m_LastSendTime && ts*1000 > m_LastSendTime*1000 + m_PacingTime)
|
||||||
{
|
{
|
||||||
m_NumPacketsToSend = ((ts*1000 - m_LastSendTime*1000) + m_PacingTimeRem) / m_PacingTime;
|
if (m_PacingTime)
|
||||||
m_PacingTimeRem = ((ts*1000 - m_LastSendTime*1000) + m_PacingTimeRem) - (m_NumPacketsToSend * m_PacingTime);
|
{
|
||||||
|
auto numPackets = std::lldiv (m_PacingTimeRem + ts*1000 - m_LastSendTime*1000, m_PacingTime);
|
||||||
|
m_NumPacketsToSend = numPackets.quot;
|
||||||
|
m_PacingTimeRem = numPackets.rem;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LogPrint (eLogError, "Streaming: pacing time is zero");
|
||||||
|
m_NumPacketsToSend = 1; m_PacingTimeRem = 0;
|
||||||
|
}
|
||||||
m_IsSendTime = true;
|
m_IsSendTime = true;
|
||||||
if (m_WindowIncCounter && m_WindowSize < MAX_WINDOW_SIZE && !m_SendBuffer.IsEmpty () && m_PacingTime > m_MinPacingTime)
|
if (m_WindowIncCounter && m_WindowSize < MAX_WINDOW_SIZE && !m_SendBuffer.IsEmpty () && m_PacingTime > m_MinPacingTime)
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,7 +69,8 @@ namespace stream
|
||||||
const int PENDING_INCOMING_TIMEOUT = 10; // in seconds
|
const int PENDING_INCOMING_TIMEOUT = 10; // in seconds
|
||||||
const int MAX_RECEIVE_TIMEOUT = 20; // in seconds
|
const int MAX_RECEIVE_TIMEOUT = 20; // in seconds
|
||||||
const uint16_t DELAY_CHOKING = 60000; // in milliseconds
|
const uint16_t DELAY_CHOKING = 60000; // in milliseconds
|
||||||
const uint64_t SEND_INTERVAL = 1000; // in microseconds
|
const uint64_t SEND_INTERVAL = 10000; // in microseconds
|
||||||
|
const uint64_t SEND_INTERVAL_VARIANCE = 2000; // in microseconds
|
||||||
const uint64_t REQUEST_IMMEDIATE_ACK_INTERVAL = 7500; // in milliseconds
|
const uint64_t REQUEST_IMMEDIATE_ACK_INTERVAL = 7500; // in milliseconds
|
||||||
const uint64_t REQUEST_IMMEDIATE_ACK_INTERVAL_VARIANCE = 3200; // in milliseconds
|
const uint64_t REQUEST_IMMEDIATE_ACK_INTERVAL_VARIANCE = 3200; // in milliseconds
|
||||||
const bool LOSS_BASED_CONTROL_ENABLED = 1; // 0/1
|
const bool LOSS_BASED_CONTROL_ENABLED = 1; // 0/1
|
||||||
|
|
Loading…
Reference in a new issue