Correctify d6d transport parameter id and xmit them during handshake
Summary: We need to increase those parameter Ids above 0xFF00, and xmit them.
MODIFY
quic/QuicConstants.h
quic/QuicConstants.h
@@ -257,11 +257,11 @@ using TransportPartialReliabilitySetting = bool;
constexpr uint16_t kPartialReliabilityParameterId = 0xFF00; // subject to change
-constexpr uint16_t kD6DBasePMTUParameterId = 0x0377;
+constexpr uint16_t kD6DBasePMTUParameterId = 0xFF77;
-constexpr uint16_t kD6DRaiseTimeoutParameterId = 0xF695;
+constexpr uint16_t kD6DRaiseTimeoutParameterId = 0xFF95;
-constexpr uint16_t kD6DProbeTimeoutParameterId = 0x9012;
+constexpr uint16_t kD6DProbeTimeoutParameterId = 0xFF12;
constexpr uint32_t kDrainFactor = 3;

MODIFY
quic/client/QuicClientTransport.cpp
quic/client/QuicClientTransport.cpp
@@ -872,6 +872,9 @@ void QuicClientTransport::startCryptoHandshake() {
// Add partial reliability parameter to customTransportParameters_.
setPartialReliabilityTransportParameter();
+ setD6DBasePMTUTransportParameter();
+ setD6DRaiseTimeoutTransportParameter();
+ setD6DProbeTimeoutTransportParameter();
auto paramsExtension = std::make_shared<ClientTransportParametersExtension>(
conn_->originalVersion.value(),

MODIFY
quic/fizz/client/test/QuicClientTransportTest.cpp
quic/fizz/client/test/QuicClientTransportTest.cpp
@@ -244,6 +244,12 @@ class QuicClientTransportIntegrationTest : public TestWithParam<TestingParams> {
std::shared_ptr<QuicServer> createServer(ProcessId processId) {
auto server = QuicServer::createQuicServer();
auto transportSettings = server->getTransportSettings();
+ auto statsFactory = std::make_unique<NiceMock<MockQuicStatsFactory>>();
+ ON_CALL(*statsFactory, make()).WillByDefault(Invoke([&]() {
+ auto newStatsCallback = std::make_unique<NiceMock<MockQuicStats>>();
+ statsCallbacks_.push_back(newStatsCallback.get());
+ return newStatsCallback;
+ }));
transportSettings.zeroRttSourceTokenMatchingPolicy =
ZeroRttSourceTokenMatchingPolicy::LIMIT_IF_NO_EXACT_MATCH;
server->setTransportSettings(transportSettings);
@@ -251,6 +257,7 @@ class QuicClientTransportIntegrationTest : public TestWithParam<TestingParams> {
std::make_unique<EchoServerTransportFactory>());
server->setQuicUDPSocketFactory(
std::make_unique<QuicSharedUDPSocketFactory>());
+ server->setTransportStatsCallbackFactory(std::move(statsFactory));
server->setFizzContext(serverCtx);
server->setSupportedVersion({getVersion(), MVFST1});
folly::SocketAddress addr("::1", 0);
@@ -368,6 +375,7 @@ class QuicClientTransportIntegrationTest : public TestWithParam<TestingParams> {
std::shared_ptr<QuicServer> server_;
bool connected_{false};
std::shared_ptr<MockQuicStats> quicStats_;
+ std::vector<MockQuicStats*> statsCallbacks_;
};
class StreamData {
@@ -1020,6 +1028,29 @@ TEST_P(QuicClientTransportIntegrationTest, PartialReliabilityEnabledTest) {
EXPECT_TRUE(client->isPartiallyReliableTransport());
}
+TEST_P(QuicClientTransportIntegrationTest, D6DEnabledTest) {
+ expectTransportCallbacks();
+ TransportSettings settings;
+ settings.d6dConfig.enabled = true;
+ client->setTransportSettings(settings);
+
+ TransportSettings serverSettings;
+ serverSettings.d6dConfig.enabled = true;
+ serverSettings.statelessResetTokenSecret = getRandSecret();
+ server_->setTransportSettings(serverSettings);
+
+ // we only use 1 worker in test
+ EXPECT_EQ(1, statsCallbacks_.size());
+ EXPECT_CALL(*statsCallbacks_[0], onConnectionD6DStarted()).Times(1);
+
+ client->start(&clientConnCallback);
+ EXPECT_CALL(clientConnCallback, onTransportReady()).WillOnce(Invoke([&] {
+ CHECK(client->getConn().oneRttWriteCipher);
+ eventbase_.terminateLoopSoon();
+ }));
+ eventbase_.loopForever();
+}
+
TEST_P(
QuicClientTransportIntegrationTest,
PartialReliabilityEnableDisableRunTimeTest) {

Correctify d6d transport parameter id and xmit them during handshake

Summary: We need to increase those parameter Ids above 0xFF00, and xmit them.

Reviewed By: mjoras

Differential Revision: D24115117

fbshipit-source-id: cf8b4970ba8640a83bde22c1f9fdfa1d3e53e3f9