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

Do not clone if only D6D packets are outstanding

Summary:
The cloning scheduler will later bypass all D6D probes anyway. So the
hasData() API should answer False if only thing outstanding is D6D packets.

Reading the code, it's actually not very clear to me if the counter is correct
though. :/ So i left some TODO warning comments to the d6d enabling flag

(Note: this ignores all push blocking failures!)

Reviewed By: mjoras

Differential Revision: D27480434

fbshipit-source-id: 12ddded1b496b92ff5c03125c5283b8c7f3fcdb3
This commit is contained in:
Yang Chi
2021-04-19 11:07:16 -07:00
committed by Facebook GitHub Bot
parent 840970f387
commit a4d235934c
3 changed files with 76 additions and 28 deletions

View File

@@ -28,6 +28,45 @@ enum PacketBuilderType { Regular, Inplace };
namespace {
SchedulingResult sendD6DProbe(
QuicConnectionStateBase& conn,
uint64_t cipherOverhead,
uint32_t probeSize,
PacketBuilderType builderType) {
auto connId = quic::test::getTestConnectionId();
D6DProbeScheduler d6dProbeScheduler(
conn, "d6d probe", cipherOverhead, probeSize);
EXPECT_TRUE(d6dProbeScheduler.hasData());
ShortHeader shortHeader(
ProtectionType::KeyPhaseZero,
connId,
getNextPacketNum(conn, PacketNumberSpace::AppData));
if (builderType == PacketBuilderType::Regular) {
RegularQuicPacketBuilder builder(
conn.udpSendPacketLen,
std::move(shortHeader),
conn.ackStates.appDataAckState.largestAckedByPeer.value_or(0));
auto result = d6dProbeScheduler.scheduleFramesForPacket(
std::move(builder), kDefaultUDPSendPacketLen);
EXPECT_FALSE(d6dProbeScheduler.hasData());
return result;
} else {
// Just enough to build the probe
auto simpleBufAccessor = std::make_unique<SimpleBufAccessor>(probeSize);
InplaceQuicPacketBuilder builder(
*simpleBufAccessor,
conn.udpSendPacketLen,
std::move(shortHeader),
conn.ackStates.appDataAckState.largestAckedByPeer.value_or(0));
auto result = d6dProbeScheduler.scheduleFramesForPacket(
std::move(builder), kDefaultUDPSendPacketLen);
EXPECT_FALSE(d6dProbeScheduler.hasData());
return result;
}
folly::assume_unreachable();
}
PacketNum addInitialOutstandingPacket(QuicConnectionStateBase& conn) {
PacketNum nextPacketNum = getNextPacketNum(conn, PacketNumberSpace::Initial);
std::vector<uint8_t> zeroConnIdData(quic::kDefaultConnectionIdSize, 0);
@@ -482,36 +521,39 @@ TEST_P(QuicPacketSchedulerTest, D6DProbeSchedulerTest) {
connId,
getNextPacketNum(conn, PacketNumberSpace::AppData));
auto param = GetParam();
size_t packetSize = 0;
if (param == PacketBuilderType::Regular) {
RegularQuicPacketBuilder builder(
conn.udpSendPacketLen,
std::move(shortHeader),
conn.ackStates.appDataAckState.largestAckedByPeer.value_or(0));
auto result = d6dProbeScheduler.scheduleFramesForPacket(
std::move(builder), kDefaultUDPSendPacketLen);
ASSERT_TRUE(result.packet.has_value());
packetSize = result.packet->header->computeChainDataLength() +
result.packet->body->computeChainDataLength() + cipherOverhead;
} else {
// Just enough to build the probe
auto simpleBufAccessor = std::make_unique<SimpleBufAccessor>(probeSize);
InplaceQuicPacketBuilder builder(
*simpleBufAccessor,
conn.udpSendPacketLen,
std::move(shortHeader),
conn.ackStates.appDataAckState.largestAckedByPeer.value_or(0));
auto result = d6dProbeScheduler.scheduleFramesForPacket(
std::move(builder), kDefaultUDPSendPacketLen);
ASSERT_TRUE(result.packet.has_value());
packetSize = result.packet->header->computeChainDataLength() +
result.packet->body->computeChainDataLength() + cipherOverhead;
}
EXPECT_FALSE(d6dProbeScheduler.hasData());
auto result = sendD6DProbe(conn, cipherOverhead, probeSize, param);
ASSERT_TRUE(result.packet.has_value());
auto packetSize = result.packet->header->computeChainDataLength() +
result.packet->body->computeChainDataLength() + cipherOverhead;
EXPECT_EQ(packetSize, probeSize);
}
TEST_P(QuicPacketSchedulerTest, NoCloningWithOnlyD6DProbes) {
QuicClientConnectionState conn(
FizzClientQuicHandshakeContext::Builder().build());
uint64_t cipherOverhead = 2;
uint32_t probeSize = 1450;
auto param = GetParam();
auto result = sendD6DProbe(conn, cipherOverhead, probeSize, param);
ASSERT_TRUE(result.packet.has_value());
auto packetSize = result.packet->header->computeChainDataLength() +
result.packet->body->computeChainDataLength() + cipherOverhead;
updateConnection(
conn,
folly::none,
result.packet->packet,
Clock::now(),
packetSize,
result.packet->body->computeChainDataLength(),
false /* isDSRPacket */);
ASSERT_EQ(1, conn.outstandings.packets.size());
EXPECT_TRUE(conn.outstandings.packets.back().metadata.isD6DProbe);
FrameScheduler noopScheduler("noopScheduler");
CloningScheduler cloningScheduler(
noopScheduler, conn, "MarShall Mathers", cipherOverhead);
EXPECT_FALSE(cloningScheduler.hasData());
}
TEST_F(QuicPacketSchedulerTest, WriteOnlyOutstandingPacketsTest) {
QuicClientConnectionState conn(
FizzClientQuicHandshakeContext::Builder().build());