mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2024-11-10 01:10:32 +00:00
set min pacing time to 250 microseconds
This commit is contained in:
parent
81cc3e3de8
commit
efd754eb93
@ -76,14 +76,17 @@ namespace stream
|
||||
m_AckSendTimer (m_Service), m_NumSentBytes (0), m_NumReceivedBytes (0), m_Port (port),
|
||||
m_RTT (INITIAL_RTT), m_WindowSize (INITIAL_WINDOW_SIZE), m_RTO (INITIAL_RTO),
|
||||
m_AckDelay (local.GetOwner ()->GetStreamingAckDelay ()), m_PrevRTTSample (INITIAL_RTT),
|
||||
m_PrevRTT (INITIAL_RTT), m_Jitter (0), m_MinPacingTime (0),
|
||||
m_PrevRTT (INITIAL_RTT), m_Jitter (0), m_MinPacingTime (MIN_PACING_TIME),
|
||||
m_PacingTime (INITIAL_PACING_TIME), m_NumResendAttempts (0), m_MTU (STREAMING_MTU)
|
||||
{
|
||||
RAND_bytes ((uint8_t *)&m_RecvStreamID, 4);
|
||||
m_RemoteIdentity = remote->GetIdentity ();
|
||||
auto outboundSpeed = local.GetOwner ()->GetStreamingOutboundSpeed ();
|
||||
if (outboundSpeed)
|
||||
m_MinPacingTime = (1000000LL*STREAMING_MTU)/outboundSpeed;
|
||||
{
|
||||
auto minPacingTime = (1000000LL*STREAMING_MTU)/outboundSpeed;
|
||||
if (minPacingTime > m_MinPacingTime) m_MinPacingTime = minPacingTime;
|
||||
}
|
||||
}
|
||||
|
||||
Stream::Stream (boost::asio::io_service& service, StreamingDestination& local):
|
||||
@ -94,13 +97,16 @@ namespace stream
|
||||
m_ReceiveTimer (m_Service), m_SendTimer (m_Service), m_ResendTimer (m_Service), m_AckSendTimer (m_Service),
|
||||
m_NumSentBytes (0), m_NumReceivedBytes (0), m_Port (0), m_RTT (INITIAL_RTT),
|
||||
m_WindowSize (INITIAL_WINDOW_SIZE), m_RTO (INITIAL_RTO), m_AckDelay (local.GetOwner ()->GetStreamingAckDelay ()),
|
||||
m_PrevRTTSample (INITIAL_RTT), m_PrevRTT (INITIAL_RTT), m_Jitter (0), m_MinPacingTime (0),
|
||||
m_PrevRTTSample (INITIAL_RTT), m_PrevRTT (INITIAL_RTT), m_Jitter (0), m_MinPacingTime (MIN_PACING_TIME),
|
||||
m_PacingTime (INITIAL_PACING_TIME), m_NumResendAttempts (0), m_MTU (STREAMING_MTU)
|
||||
{
|
||||
RAND_bytes ((uint8_t *)&m_RecvStreamID, 4);
|
||||
auto outboundSpeed = local.GetOwner ()->GetStreamingOutboundSpeed ();
|
||||
if (outboundSpeed)
|
||||
m_MinPacingTime = (1000000LL*STREAMING_MTU)/outboundSpeed;
|
||||
{
|
||||
auto minPacingTime = (1000000LL*STREAMING_MTU)/outboundSpeed;
|
||||
if (minPacingTime > m_MinPacingTime) m_MinPacingTime = minPacingTime;
|
||||
}
|
||||
}
|
||||
|
||||
Stream::~Stream ()
|
||||
|
@ -67,6 +67,7 @@ namespace stream
|
||||
const int PENDING_INCOMING_TIMEOUT = 10; // in seconds
|
||||
const int MAX_RECEIVE_TIMEOUT = 20; // in seconds
|
||||
const uint16_t DELAY_CHOKING = 60000; // in milliseconds
|
||||
const uint64_t MIN_PACING_TIME = 250; // in microseconds. TODO: depends on OS
|
||||
|
||||
struct Packet
|
||||
{
|
||||
@ -271,7 +272,7 @@ namespace stream
|
||||
SendBufferQueue m_SendBuffer;
|
||||
double m_RTT;
|
||||
int m_WindowSize, m_RTO, m_AckDelay, m_PrevRTTSample, m_PrevRTT, m_Jitter;
|
||||
uint64_t m_MinPacingTime, m_PacingTime;
|
||||
uint64_t m_MinPacingTime, m_PacingTime; // miscroseconds
|
||||
int m_NumResendAttempts;
|
||||
size_t m_MTU;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user