mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 13:27:17 +01:00
Changing the window calculation algorithm, increasing the minimum window size
Some checks are pending
Build Debian packages / ${{ matrix.dist }} (bookworm) (push) Waiting to run
Build Debian packages / ${{ matrix.dist }} (bullseye) (push) Waiting to run
Build Debian packages / ${{ matrix.dist }} (buster) (push) Waiting to run
Build on FreeBSD / with UPnP (push) Waiting to run
Build on OSX / With USE_UPNP=${{ matrix.with_upnp }} (no) (push) Waiting to run
Build on OSX / With USE_UPNP=${{ matrix.with_upnp }} (yes) (push) Waiting to run
Build on Windows / ${{ matrix.arch }} (clang-x86_64, x64-clang, clang, CLANG64) (push) Waiting to run
Build on Windows / ${{ matrix.arch }} (i686, x86, gcc, MINGW32) (push) Waiting to run
Build on Windows / ${{ matrix.arch }} (ucrt-x86_64, x64-ucrt, gcc, UCRT64) (push) Waiting to run
Build on Windows / ${{ matrix.arch }} (x86_64, x64, gcc, MINGW64) (push) Waiting to run
Build on Windows / CMake ${{ matrix.arch }} (clang-x86_64, x64-clang, clang, CLANG64) (push) Waiting to run
Build on Windows / CMake ${{ matrix.arch }} (i686, x86, gcc, MINGW32) (push) Waiting to run
Build on Windows / CMake ${{ matrix.arch }} (ucrt-x86_64, x64-ucrt, gcc, UCRT64) (push) Waiting to run
Build on Windows / CMake ${{ matrix.arch }} (x86_64, x64, gcc, MINGW64) (push) Waiting to run
Build on Windows / XP (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=${{ matrix.with_upnp }} (no) (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=${{ matrix.with_upnp }} (yes) (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=${{ matrix.with_upnp }} (OFF) (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=${{ matrix.with_upnp }} (ON) (push) Waiting to run
Build containers / Building container for ${{ matrix.platform }} (i386, linux/386) (push) Waiting to run
Build containers / Pushing merged manifest (push) Blocked by required conditions
Build containers / Building container for ${{ matrix.platform }} (amd64, linux/amd64) (push) Waiting to run
Build containers / Building container for ${{ matrix.platform }} (arm64, linux/arm64) (push) Waiting to run
Build containers / Building container for ${{ matrix.platform }} (armv7, linux/arm/v7) (push) Waiting to run
Some checks are pending
Build Debian packages / ${{ matrix.dist }} (bookworm) (push) Waiting to run
Build Debian packages / ${{ matrix.dist }} (bullseye) (push) Waiting to run
Build Debian packages / ${{ matrix.dist }} (buster) (push) Waiting to run
Build on FreeBSD / with UPnP (push) Waiting to run
Build on OSX / With USE_UPNP=${{ matrix.with_upnp }} (no) (push) Waiting to run
Build on OSX / With USE_UPNP=${{ matrix.with_upnp }} (yes) (push) Waiting to run
Build on Windows / ${{ matrix.arch }} (clang-x86_64, x64-clang, clang, CLANG64) (push) Waiting to run
Build on Windows / ${{ matrix.arch }} (i686, x86, gcc, MINGW32) (push) Waiting to run
Build on Windows / ${{ matrix.arch }} (ucrt-x86_64, x64-ucrt, gcc, UCRT64) (push) Waiting to run
Build on Windows / ${{ matrix.arch }} (x86_64, x64, gcc, MINGW64) (push) Waiting to run
Build on Windows / CMake ${{ matrix.arch }} (clang-x86_64, x64-clang, clang, CLANG64) (push) Waiting to run
Build on Windows / CMake ${{ matrix.arch }} (i686, x86, gcc, MINGW32) (push) Waiting to run
Build on Windows / CMake ${{ matrix.arch }} (ucrt-x86_64, x64-ucrt, gcc, UCRT64) (push) Waiting to run
Build on Windows / CMake ${{ matrix.arch }} (x86_64, x64, gcc, MINGW64) (push) Waiting to run
Build on Windows / XP (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=${{ matrix.with_upnp }} (no) (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=${{ matrix.with_upnp }} (yes) (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=${{ matrix.with_upnp }} (OFF) (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=${{ matrix.with_upnp }} (ON) (push) Waiting to run
Build containers / Building container for ${{ matrix.platform }} (i386, linux/386) (push) Waiting to run
Build containers / Pushing merged manifest (push) Blocked by required conditions
Build containers / Building container for ${{ matrix.platform }} (amd64, linux/amd64) (push) Waiting to run
Build containers / Building container for ${{ matrix.platform }} (arm64, linux/arm64) (push) Waiting to run
Build containers / Building container for ${{ matrix.platform }} (armv7, linux/arm/v7) (push) Waiting to run
This commit is contained in:
parent
e996db03c0
commit
13604ccbb6
|
@ -73,7 +73,7 @@ namespace stream
|
||||||
m_LastConfirmedReceivedSequenceNumber (0), // for limit inbound speed
|
m_LastConfirmedReceivedSequenceNumber (0), // for limit inbound speed
|
||||||
m_Status (eStreamStatusNew), m_IsIncoming (false), m_IsAckSendScheduled (false), m_IsNAcked (false), m_IsFirstACK (false),
|
m_Status (eStreamStatusNew), m_IsIncoming (false), m_IsAckSendScheduled (false), m_IsNAcked (false), m_IsFirstACK (false),
|
||||||
m_IsResendNeeded (false), m_IsFirstRttSample (false), m_IsSendTime (true), m_IsWinDropped (false),
|
m_IsResendNeeded (false), m_IsFirstRttSample (false), m_IsSendTime (true), m_IsWinDropped (false),
|
||||||
m_IsTimeOutResend (false), m_IsImmediateAckRequested (false), m_IsRemoteLeaseChangeInProgress (false), m_LocalDestination (local),
|
m_IsTimeOutResend (false), m_IsImmediateAckRequested (false), m_IsRemoteLeaseChangeInProgress (false), m_DoubleWinIncCounter (false), m_LocalDestination (local),
|
||||||
m_RemoteLeaseSet (remote), m_ReceiveTimer (m_Service), m_SendTimer (m_Service), m_ResendTimer (m_Service),
|
m_RemoteLeaseSet (remote), m_ReceiveTimer (m_Service), m_SendTimer (m_Service), m_ResendTimer (m_Service),
|
||||||
m_AckSendTimer (m_Service), m_NumSentBytes (0), m_NumReceivedBytes (0), m_Port (port),
|
m_AckSendTimer (m_Service), m_NumSentBytes (0), m_NumReceivedBytes (0), m_Port (port),
|
||||||
m_RTT (INITIAL_RTT), m_SlowRTT (INITIAL_RTT), m_SlowRTT2 (INITIAL_RTT), m_WindowSize (INITIAL_WINDOW_SIZE), m_LastWindowDropSize (0),
|
m_RTT (INITIAL_RTT), m_SlowRTT (INITIAL_RTT), m_SlowRTT2 (INITIAL_RTT), m_WindowSize (INITIAL_WINDOW_SIZE), m_LastWindowDropSize (0),
|
||||||
|
@ -101,7 +101,7 @@ namespace stream
|
||||||
m_LastConfirmedReceivedSequenceNumber (0), // for limit inbound speed
|
m_LastConfirmedReceivedSequenceNumber (0), // for limit inbound speed
|
||||||
m_Status (eStreamStatusNew), m_IsIncoming (true), m_IsAckSendScheduled (false), m_IsNAcked (false), m_IsFirstACK (false),
|
m_Status (eStreamStatusNew), m_IsIncoming (true), m_IsAckSendScheduled (false), m_IsNAcked (false), m_IsFirstACK (false),
|
||||||
m_IsResendNeeded (false), m_IsFirstRttSample (false), m_IsSendTime (true), m_IsWinDropped (false),
|
m_IsResendNeeded (false), m_IsFirstRttSample (false), m_IsSendTime (true), m_IsWinDropped (false),
|
||||||
m_IsTimeOutResend (false), m_IsImmediateAckRequested (false), m_IsRemoteLeaseChangeInProgress (false), m_LocalDestination (local),
|
m_IsTimeOutResend (false), m_IsImmediateAckRequested (false), m_IsRemoteLeaseChangeInProgress (false), m_DoubleWinIncCounter (false), m_LocalDestination (local),
|
||||||
m_ReceiveTimer (m_Service), m_SendTimer (m_Service), m_ResendTimer (m_Service), m_AckSendTimer (m_Service),
|
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_SlowRTT (INITIAL_RTT), m_SlowRTT2 (INITIAL_RTT),
|
m_NumSentBytes (0), m_NumReceivedBytes (0), m_Port (0), m_RTT (INITIAL_RTT), m_SlowRTT (INITIAL_RTT), m_SlowRTT2 (INITIAL_RTT),
|
||||||
m_WindowSize (INITIAL_WINDOW_SIZE), m_LastWindowDropSize (0), m_WindowDropTargetSize (0), m_WindowIncCounter (0),
|
m_WindowSize (INITIAL_WINDOW_SIZE), m_LastWindowDropSize (0), m_WindowDropTargetSize (0), m_WindowIncCounter (0),
|
||||||
|
@ -495,6 +495,7 @@ namespace stream
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int rttSample = INT_MAX;
|
int rttSample = INT_MAX;
|
||||||
|
int incCounter = 0;
|
||||||
m_IsNAcked = false;
|
m_IsNAcked = false;
|
||||||
m_IsResendNeeded = false;
|
m_IsResendNeeded = false;
|
||||||
int nackCount = packet->GetNACKCount ();
|
int nackCount = packet->GetNACKCount ();
|
||||||
|
@ -537,8 +538,7 @@ namespace stream
|
||||||
m_LocalDestination.DeletePacket (sentPacket);
|
m_LocalDestination.DeletePacket (sentPacket);
|
||||||
acknowledged = true;
|
acknowledged = true;
|
||||||
if (m_WindowSize < MAX_WINDOW_SIZE && !m_IsFirstACK)
|
if (m_WindowSize < MAX_WINDOW_SIZE && !m_IsFirstACK)
|
||||||
if (m_RTT < m_LocalDestination.GetRandom () % INITIAL_RTO) // dirty
|
incCounter++;
|
||||||
m_WindowIncCounter++;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
|
@ -552,7 +552,7 @@ namespace stream
|
||||||
m_SlowRTT2 = rttSample;
|
m_SlowRTT2 = rttSample;
|
||||||
m_PrevRTTSample = rttSample;
|
m_PrevRTTSample = rttSample;
|
||||||
m_Jitter = rttSample / 10; // 10%
|
m_Jitter = rttSample / 10; // 10%
|
||||||
m_Jitter += 5; // for low-latency connections
|
m_Jitter += 15; // for low-latency connections
|
||||||
m_IsFirstRttSample = false;
|
m_IsFirstRttSample = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -569,9 +569,23 @@ namespace stream
|
||||||
jitter = m_PrevRTTSample - rttSample;
|
jitter = m_PrevRTTSample - rttSample;
|
||||||
else
|
else
|
||||||
jitter = rttSample / 10; // 10%
|
jitter = rttSample / 10; // 10%
|
||||||
jitter += 5; // for low-latency connections
|
jitter += 15; // for low-latency connections
|
||||||
m_Jitter = (0.05 * jitter) + (1.0 - 0.05) * m_Jitter;
|
m_Jitter = (0.05 * jitter) + (1.0 - 0.05) * m_Jitter;
|
||||||
}
|
}
|
||||||
|
if (rttSample > m_SlowRTT)
|
||||||
|
{
|
||||||
|
incCounter = 0;
|
||||||
|
m_DoubleWinIncCounter = 1;
|
||||||
|
}
|
||||||
|
else if (rttSample < m_SlowRTT)
|
||||||
|
{
|
||||||
|
if (m_DoubleWinIncCounter)
|
||||||
|
{
|
||||||
|
incCounter = incCounter * 2;
|
||||||
|
m_DoubleWinIncCounter = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_WindowIncCounter = m_WindowIncCounter + incCounter;
|
||||||
//
|
//
|
||||||
// delay-based CC
|
// delay-based CC
|
||||||
if ((m_SlowRTT2 > m_SlowRTT + m_Jitter && rttSample > m_SlowRTT2 && rttSample > m_PrevRTTSample) && !m_IsWinDropped) // Drop window if RTT grows too fast, late detection
|
if ((m_SlowRTT2 > m_SlowRTT + m_Jitter && rttSample > m_SlowRTT2 && rttSample > m_PrevRTTSample) && !m_IsWinDropped) // Drop window if RTT grows too fast, late detection
|
||||||
|
@ -1297,8 +1311,6 @@ namespace stream
|
||||||
else if (m_IsResendNeeded) // resend packets
|
else if (m_IsResendNeeded) // resend packets
|
||||||
ResendPacket ();
|
ResendPacket ();
|
||||||
// delay-based CC
|
// delay-based CC
|
||||||
else if (!m_IsWinDropped && int(m_SentPackets.size ()) == m_WindowSize) // we sending packets too fast, early detection
|
|
||||||
ProcessWindowDrop ();
|
|
||||||
else if (m_WindowSize > int(m_SentPackets.size ())) // send packets
|
else if (m_WindowSize > int(m_SentPackets.size ())) // send packets
|
||||||
SendBuffer ();
|
SendBuffer ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
#include "Base.h"
|
#include "Base.h"
|
||||||
|
#include "Gzip.h"
|
||||||
#include "I2PEndian.h"
|
#include "I2PEndian.h"
|
||||||
#include "Identity.h"
|
#include "Identity.h"
|
||||||
#include "LeaseSet.h"
|
#include "LeaseSet.h"
|
||||||
|
@ -54,7 +55,7 @@ namespace stream
|
||||||
const size_t COMPRESSION_THRESHOLD_SIZE = 66;
|
const size_t COMPRESSION_THRESHOLD_SIZE = 66;
|
||||||
const int MAX_NUM_RESEND_ATTEMPTS = 10;
|
const int MAX_NUM_RESEND_ATTEMPTS = 10;
|
||||||
const int INITIAL_WINDOW_SIZE = 10;
|
const int INITIAL_WINDOW_SIZE = 10;
|
||||||
const int MIN_WINDOW_SIZE = 2;
|
const int MIN_WINDOW_SIZE = 3;
|
||||||
const int MAX_WINDOW_SIZE = 512;
|
const int MAX_WINDOW_SIZE = 512;
|
||||||
const double RTT_EWMA_ALPHA = 0.25;
|
const double RTT_EWMA_ALPHA = 0.25;
|
||||||
const double SLOWRTT_EWMA_ALPHA = 0.05;
|
const double SLOWRTT_EWMA_ALPHA = 0.05;
|
||||||
|
@ -274,6 +275,7 @@ namespace stream
|
||||||
bool m_IsTimeOutResend;
|
bool m_IsTimeOutResend;
|
||||||
bool m_IsImmediateAckRequested;
|
bool m_IsImmediateAckRequested;
|
||||||
bool m_IsRemoteLeaseChangeInProgress;
|
bool m_IsRemoteLeaseChangeInProgress;
|
||||||
|
bool m_DoubleWinIncCounter;
|
||||||
StreamingDestination& m_LocalDestination;
|
StreamingDestination& m_LocalDestination;
|
||||||
std::shared_ptr<const i2p::data::IdentityEx> m_RemoteIdentity;
|
std::shared_ptr<const i2p::data::IdentityEx> m_RemoteIdentity;
|
||||||
std::shared_ptr<const i2p::crypto::Verifier> m_TransientVerifier; // in case of offline key
|
std::shared_ptr<const i2p::crypto::Verifier> m_TransientVerifier; // in case of offline key
|
||||||
|
|
Loading…
Reference in a new issue