Commit b7da4e00 authored by jan.koester's avatar jan.koester
Browse files

gap

parent 3931d366
Loading
Loading
Loading
Loading
+15 −0
Changes for src/quic.cpp: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -5721,6 +5721,21 @@ void quic::trackRecvPN(uint64_t pn, std::set<std::pair<uint64_t,uint64_t>>& rang
            break;
        }
    }

    // Bound growth: a gap left by a packet this library will never see
    // again (the peer always retransmits lost data under a fresh PN, so
    // the original PN is a permanent hole — see recordSentPacket()/
    // checkLossAndRetransmit()) can never merge away, so on a long
    // connection with sustained loss this set would otherwise grow by one
    // entry per loss for the connection's entire lifetime. buildAckFrame()
    // only ever encodes the newest MAX_ACK_RANGES_PER_FRAME + 1 ranges
    // (see its comment), so anything older than that is already unreachable
    // from any future ACK frame — safe to drop here instead of retaining it
    // forever.
    constexpr size_t kMaxRanges = static_cast<size_t>(MAX_ACK_RANGES_PER_FRAME) + 1;
    while (ranges.size() > kMaxRanges) {
        ranges.erase(ranges.begin());
    }
}

std::vector<uint8_t> quic::buildAckFrame(uint64_t largest_ack, uint64_t ack_delay,