Prevent the sender from sending too far ahead of an unacked packet

This commit is contained in:
Zlatin Balevsky
2021-09-02 18:22:12 +01:00
parent a66422fa3c
commit 1ae05103e4

View File

@@ -233,7 +233,7 @@ class Connection {
int wsz = _options.getWindowSize();
if (_isChoked || unacked >= wsz ||
_activeResends.get() >= (wsz + 1) / 2 ||
_lastSendId.get() - _highestAckedThrough >= Math.max(MAX_WINDOW_SIZE, 2 * wsz)) {
_lastSendId.get() - _highestAckedThrough >= Math.min(MAX_WINDOW_SIZE, 2 * wsz)) {
if (timeoutMs > 0) {
if (timeLeft <= 0) {
if (_log.shouldLog(Log.INFO))