mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-08-06 22:22:38 +03:00
Fix Probing Bytes Limit
Summary: - PTOs should not be subject to congestion control limits - Quickly recover from PTOs being writableBytesLimited by calling onPTOAlarm() as soon as we become unblocked Reviewed By: mjoras Differential Revision: D35480409 fbshipit-source-id: 51500db6fff17a7badefea8bda7f63141e97f746
This commit is contained in:
committed by
Facebook GitHub Bot
parent
52fedd687f
commit
747c41c30d
@@ -2970,8 +2970,10 @@ TEST_F(QuicTransportFunctionsTest, WriteProbingNewData) {
|
||||
auto currentPacketSeqNum = conn->ackStates.appDataAckState.nextPacketNum;
|
||||
auto mockCongestionController =
|
||||
std::make_unique<NiceMock<MockCongestionController>>();
|
||||
// Probing data is not limited by congestion control, this should not affect
|
||||
// anything
|
||||
EXPECT_CALL(*mockCongestionController, getWritableBytes())
|
||||
.WillRepeatedly(Return(2000));
|
||||
.WillRepeatedly(Return(0));
|
||||
auto rawCongestionController = mockCongestionController.get();
|
||||
conn->congestionController = std::move(mockCongestionController);
|
||||
EventBase evb;
|
||||
@@ -3061,8 +3063,10 @@ TEST_F(QuicTransportFunctionsTest, WriteProbingCryptoData) {
|
||||
// Replace real congestionController with MockCongestionController:
|
||||
auto mockCongestionController =
|
||||
std::make_unique<NiceMock<MockCongestionController>>();
|
||||
// Probing data is not limited by congestion control, this should not affect
|
||||
// anything
|
||||
EXPECT_CALL(*mockCongestionController, getWritableBytes())
|
||||
.WillRepeatedly(Return(2000));
|
||||
.WillRepeatedly(Return(0));
|
||||
auto rawCongestionController = mockCongestionController.get();
|
||||
conn.congestionController = std::move(mockCongestionController);
|
||||
EventBase evb;
|
||||
@@ -3091,6 +3095,54 @@ TEST_F(QuicTransportFunctionsTest, WriteProbingCryptoData) {
|
||||
EXPECT_FALSE(cryptoStream->retransmissionBuffer.empty());
|
||||
}
|
||||
|
||||
TEST_F(QuicTransportFunctionsTest, WriteableBytesLimitedProbingCryptoData) {
|
||||
QuicServerConnectionState conn(
|
||||
FizzServerQuicHandshakeContext::Builder().build());
|
||||
conn.statsCallback = quicStats_.get();
|
||||
conn.transportSettings.enableWritableBytesLimit = true;
|
||||
conn.writableBytesLimit = 2 * conn.udpSendPacketLen;
|
||||
|
||||
conn.serverConnectionId = getTestConnectionId();
|
||||
conn.clientConnectionId = getTestConnectionId();
|
||||
// writeCryptoDataProbesToSocketForTest writes Initial LongHeader, thus it
|
||||
// writes at Initial level.
|
||||
auto currentPacketSeqNum = conn.ackStates.initialAckState.nextPacketNum;
|
||||
// Replace real congestionController with MockCongestionController:
|
||||
auto mockCongestionController =
|
||||
std::make_unique<NiceMock<MockCongestionController>>();
|
||||
auto rawCongestionController = mockCongestionController.get();
|
||||
conn.congestionController = std::move(mockCongestionController);
|
||||
EventBase evb;
|
||||
auto socket =
|
||||
std::make_unique<NiceMock<folly::test::MockAsyncUDPSocket>>(&evb);
|
||||
auto rawSocket = socket.get();
|
||||
auto cryptoStream = &conn.cryptoState->initialStream;
|
||||
uint8_t probesToSend = 4;
|
||||
auto buf = buildRandomInputData(conn.udpSendPacketLen * probesToSend);
|
||||
EXPECT_CALL(*quicStats_, onConnectionWritableBytesLimited())
|
||||
.Times(AtLeast(1));
|
||||
writeDataToQuicStream(*cryptoStream, buf->clone());
|
||||
|
||||
auto currentStreamWriteOffset = cryptoStream->currentWriteOffset;
|
||||
EXPECT_CALL(*rawCongestionController, onPacketSent(_)).Times(2);
|
||||
EXPECT_CALL(*rawSocket, write(_, _))
|
||||
.WillRepeatedly(Invoke([&](const SocketAddress&,
|
||||
const std::unique_ptr<folly::IOBuf>& iobuf) {
|
||||
auto len = iobuf->computeChainDataLength();
|
||||
EXPECT_EQ(conn.udpSendPacketLen - aead->getCipherOverhead(), len);
|
||||
return len;
|
||||
}));
|
||||
writeCryptoDataProbesToSocketForTest(
|
||||
*rawSocket, conn, probesToSend, *aead, *headerCipher, getVersion(conn));
|
||||
|
||||
EXPECT_EQ(conn.numProbesWritableBytesLimited, 1);
|
||||
EXPECT_LT(currentPacketSeqNum, conn.ackStates.initialAckState.nextPacketNum);
|
||||
EXPECT_FALSE(conn.outstandings.packets.empty());
|
||||
EXPECT_TRUE(conn.pendingEvents.setLossDetectionAlarm);
|
||||
EXPECT_GT(cryptoStream->currentWriteOffset, currentStreamWriteOffset);
|
||||
EXPECT_FALSE(cryptoStream->retransmissionBuffer.empty());
|
||||
}
|
||||
|
||||
TEST_F(QuicTransportFunctionsTest, ProbingNotFallbackToPingWhenNoQuota) {
|
||||
auto conn = createConn();
|
||||
auto mockCongestionController =
|
||||
|
Reference in New Issue
Block a user