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

Fix bad probe sending condition in crypto writes

Summary: Wrong parenthesis

Reviewed By: mjoras

Differential Revision: D23655249

fbshipit-source-id: 03480601ed50053d7f19fe79d77f831d6349aa6e
This commit is contained in:
Yang Chi
2020-09-12 16:48:23 -07:00
committed by Facebook GitHub Bot
parent bd1f0d1633
commit 95f3730569
2 changed files with 44 additions and 4 deletions

View File

@@ -1638,7 +1638,6 @@ TEST_F(QuicTransportFunctionsTest, ProbingFallbackToPing) {
TEST_F(QuicTransportFunctionsTest, TestCryptoWritingIsHandshakeInOutstanding) {
auto conn = createConn();
// TODO: use handshake write cipher with draft-14.
auto cryptoStream = &conn->cryptoState->initialStream;
auto buf = buildRandomInputData(200);
writeDataToQuicStream(*cryptoStream, buf->clone());
@@ -1663,6 +1662,48 @@ TEST_F(QuicTransportFunctionsTest, TestCryptoWritingIsHandshakeInOutstanding) {
->isHandshake);
}
TEST_F(QuicTransportFunctionsTest, NoCryptoProbeWriteIfNoProbeCredit) {
auto conn = createConn();
auto cryptoStream = &conn->cryptoState->initialStream;
auto buf = buildRandomInputData(200);
writeDataToQuicStream(*cryptoStream, buf->clone());
EventBase evb;
auto socket =
std::make_unique<NiceMock<folly::test::MockAsyncUDPSocket>>(&evb);
auto rawSocket = socket.get();
EXPECT_EQ(
1,
writeCryptoAndAckDataToSocket(
*rawSocket,
*conn,
*conn->clientConnectionId,
*conn->serverConnectionId,
LongHeader::Types::Initial,
*conn->initialWriteCipher,
*conn->initialHeaderCipher,
getVersion(*conn),
conn->transportSettings.writeConnectionDataPacketsLimit));
ASSERT_EQ(1, conn->outstandings.packets.size());
EXPECT_TRUE(getFirstOutstandingPacket(*conn, PacketNumberSpace::Initial)
->isHandshake);
ASSERT_EQ(1, cryptoStream->retransmissionBuffer.size());
ASSERT_TRUE(cryptoStream->writeBuffer.empty());
conn->pendingEvents.numProbePackets = 0;
EXPECT_EQ(
0,
writeCryptoAndAckDataToSocket(
*rawSocket,
*conn,
*conn->clientConnectionId,
*conn->serverConnectionId,
LongHeader::Types::Initial,
*conn->initialWriteCipher,
*conn->initialHeaderCipher,
getVersion(*conn),
conn->transportSettings.writeConnectionDataPacketsLimit));
}
TEST_F(QuicTransportFunctionsTest, WritePureAckWhenNoWritableBytes) {
auto conn = createConn();
auto mockCongestionController =