1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-08-06 22:22:38 +03:00

Quic Probing can write frames other than stream frames

Summary:
During PTO, when we try to write new data, we have been limiting to
only stream data and crypto data. This diff adds a few more types of data to
write during probes if they are available: Simple frame, Window updates, Rst
and Blocked frames.

Right now Acks won't be included here.

Reviewed By: mjoras

Differential Revision: D21460861

fbshipit-source-id: d75a296e96375690eee5e609efd7d1b5c103e8da
This commit is contained in:
Yang Chi
2020-05-10 09:30:40 -07:00
committed by Facebook GitHub Bot
parent 746baad146
commit fd41b0e324
2 changed files with 51 additions and 0 deletions

View File

@@ -2233,5 +2233,52 @@ TEST_F(QuicTransportFunctionsTest, HandshakeConfirmedDropCipher) {
EXPECT_EQ(nullptr, conn->readCodec->getHandshakeHeaderCipher());
}
TEST_F(QuicTransportFunctionsTest, ProbeWriteNewFunctionalFrames) {
auto conn = createConn();
conn->udpSendPacketLen = 1200;
EventBase evb;
auto sock = std::make_unique<NiceMock<folly::test::MockAsyncUDPSocket>>(&evb);
auto rawSocket = sock.get();
EXPECT_CALL(*rawSocket, write(_, _))
.WillRepeatedly(Invoke([&](const SocketAddress&,
const std::unique_ptr<folly::IOBuf>& iobuf) {
return iobuf->computeChainDataLength();
}));
auto stream = conn->streamManager->createNextBidirectionalStream().value();
auto buf = folly::IOBuf::copyBuffer("Drug facts");
writeDataToQuicStream(*stream, buf->clone(), true);
writeQuicDataToSocket(
*rawSocket,
*conn,
*conn->clientConnectionId,
*conn->serverConnectionId,
*aead,
*headerCipher,
getVersion(*conn),
conn->transportSettings.writeConnectionDataPacketsLimit);
ASSERT_EQ(1, stream->retransmissionBuffer.size());
conn->pendingEvents.numProbePackets = 1;
conn->flowControlState.windowSize *= 2;
conn->flowControlState.timeOfLastFlowControlUpdate = Clock::now() - 20s;
maybeSendConnWindowUpdate(*conn, Clock::now());
writeQuicDataToSocket(
*rawSocket,
*conn,
*conn->clientConnectionId,
*conn->serverConnectionId,
*aead,
*headerCipher,
getVersion(*conn),
1 /* limit to 1 packet */);
EXPECT_EQ(2, conn->outstandingPackets.size());
EXPECT_EQ(1, conn->outstandingPackets[1].packet.frames.size());
EXPECT_EQ(
QuicWriteFrame::Type::MaxDataFrame_E,
conn->outstandingPackets[1].packet.frames[0].type());
}
} // namespace test
} // namespace quic