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

Do not fallback to Ping if any probe is written, or if we don't have probe

Summary: as title.

Reviewed By: mjoras

Differential Revision: D22044917

fbshipit-source-id: 18a4c988633c04233591bc596fd811ebe98c1171
This commit is contained in:
Yang Chi
2020-06-18 15:28:59 -07:00
committed by Facebook GitHub Bot
parent 25a646f96a
commit 4790a5792d
2 changed files with 25 additions and 1 deletions

View File

@@ -1223,7 +1223,7 @@ uint64_t writeProbingDataToSocket(
aead, aead,
headerCipher, headerCipher,
version); version);
if (written < probesToSend) { if (probesToSend && !written) {
// Fall back to send a ping: // Fall back to send a ping:
sendSimpleFrame(connection, PingFrame()); sendSimpleFrame(connection, PingFrame());
auto pingScheduler = std::move(FrameScheduler::Builder( auto pingScheduler = std::move(FrameScheduler::Builder(

View File

@@ -1572,6 +1572,30 @@ TEST_F(QuicTransportFunctionsTest, WriteProbingCryptoData) {
EXPECT_FALSE(cryptoStream->retransmissionBuffer.empty()); EXPECT_FALSE(cryptoStream->retransmissionBuffer.empty());
} }
TEST_F(QuicTransportFunctionsTest, ProbingNotFallbackToPingWhenNoQuota) {
auto conn = createConn();
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();
EXPECT_CALL(*rawCongestionController, onPacketSent(_)).Times(0);
EXPECT_CALL(*rawSocket, write(_, _)).Times(0);
uint8_t probesToSend = 0;
EXPECT_EQ(
0,
writeProbingDataToSocketForTest(
*rawSocket,
*conn,
probesToSend,
*aead,
*headerCipher,
getVersion(*conn)));
}
TEST_F(QuicTransportFunctionsTest, ProbingFallbackToPing) { TEST_F(QuicTransportFunctionsTest, ProbingFallbackToPing) {
auto conn = createConn(); auto conn = createConn();
auto mockCongestionController = auto mockCongestionController =