Skip to content

Commit 8357038

Browse files
Ilango Purushothamanfacebook-github-bot
authored andcommitted
Cache Ack Rx timestamps transport settings in PSK cache for 0-rtt
Summary: Ack Rx timestamps are currently disabled on 0-rtt connections, which is enabled on mvfst for all non-video connections. This is because the timestamp config is negotiated with transport settings during handshake which doesn't happen on a new 0-rtt connection (resumption). Solution: Store the peer's rx timestamp config in PSKCache on the client. On 0-rtt resumption of the connection, this peer config is restored and used to send Rx timestamps (if enabled). Note that if the server had changed its timestamp config during this period (through configerator) then the server needs to reject this 0-rtt connection and start anew. Server code changes to support this will be in a followup diff. With this client diff though, server will drop the Rx timestamps if its own config is suddenly disabled (this is a waste of network resource). Reviewed By: jbeshay Differential Revision: D58572572 fbshipit-source-id: d95720c177ac4bc8dcbe40362f19b279b3f8e708
1 parent 3206bfc commit 8357038

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

proxygen/lib/transport/PersistentQuicPskCache.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ folly::Optional<quic::QuicCachedPsk> PersistentQuicPskCache::getPsk(
6868
uint8_t knobFrameSupport;
6969
fizz::detail::read(knobFrameSupport, cursor);
7070
quicCachedPsk.transportParams.knobFrameSupport = knobFrameSupport > 0;
71+
uint8_t ackReceiveTimestampsEnabled;
72+
fizz::detail::read(ackReceiveTimestampsEnabled, cursor);
73+
quicCachedPsk.transportParams.ackReceiveTimestampsEnabled =
74+
ackReceiveTimestampsEnabled > 0;
75+
fizz::detail::read(quicCachedPsk.transportParams.maxReceiveTimestampsPerAck,
76+
cursor);
77+
fizz::detail::read(quicCachedPsk.transportParams.receiveTimestampsExponent,
78+
cursor);
7179

7280
std::unique_ptr<folly::IOBuf> appParams;
7381
fizz::detail::readBuf<uint16_t>(appParams, cursor);
@@ -110,6 +118,13 @@ void PersistentQuicPskCache::putPsk(const std::string& identity,
110118
appender);
111119
uint8_t knobSupport = quicCachedPsk.transportParams.knobFrameSupport ? 1 : 0;
112120
fizz::detail::write(knobSupport, appender);
121+
uint8_t ackReceiveTimestampsEnabled =
122+
quicCachedPsk.transportParams.ackReceiveTimestampsEnabled ? 1 : 0;
123+
fizz::detail::write(ackReceiveTimestampsEnabled, appender);
124+
fizz::detail::write(quicCachedPsk.transportParams.maxReceiveTimestampsPerAck,
125+
appender);
126+
fizz::detail::write(quicCachedPsk.transportParams.receiveTimestampsExponent,
127+
appender);
113128

114129
fizz::detail::writeBuf<uint16_t>(
115130
folly::IOBuf::wrapBuffer(folly::StringPiece(quicCachedPsk.appParams)),

proxygen/lib/transport/test/PersistentQuicPskCacheTest.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ class PersistentQuicPskCacheTest : public Test {
5757
quicPsk1_.transportParams.initialMaxStreamsBidi = 234;
5858
quicPsk1_.transportParams.initialMaxStreamsUni = 123;
5959
quicPsk1_.transportParams.knobFrameSupport = true;
60+
quicPsk1_.transportParams.ackReceiveTimestampsEnabled = true;
61+
quicPsk1_.transportParams.maxReceiveTimestampsPerAck = 30;
62+
quicPsk1_.transportParams.receiveTimestampsExponent = 0;
6063
quicPsk1_.appParams = "QPACK param";
6164

6265
auto& fizzPsk2 = quicPsk2_.cachedPsk;
@@ -85,6 +88,9 @@ class PersistentQuicPskCacheTest : public Test {
8588
quicPsk2_.transportParams.initialMaxStreamsBidi = 2345;
8689
quicPsk2_.transportParams.initialMaxStreamsUni = 1233;
8790
quicPsk2_.transportParams.knobFrameSupport = false;
91+
quicPsk1_.transportParams.ackReceiveTimestampsEnabled = false;
92+
quicPsk1_.transportParams.maxReceiveTimestampsPerAck = 10;
93+
quicPsk1_.transportParams.receiveTimestampsExponent = 0;
8894
}
8995

9096
void TearDown() override {
@@ -142,6 +148,12 @@ static void expectMatch(const QuicCachedPsk& a, const QuicCachedPsk& b) {
142148
EXPECT_EQ(paramsA.initialMaxStreamsBidi, paramsB.initialMaxStreamsBidi);
143149
EXPECT_EQ(paramsA.initialMaxStreamsUni, paramsB.initialMaxStreamsUni);
144150
EXPECT_EQ(paramsA.knobFrameSupport, paramsB.knobFrameSupport);
151+
EXPECT_EQ(paramsA.ackReceiveTimestampsEnabled,
152+
paramsB.ackReceiveTimestampsEnabled);
153+
EXPECT_EQ(paramsA.maxReceiveTimestampsPerAck,
154+
paramsB.maxReceiveTimestampsPerAck);
155+
EXPECT_EQ(paramsA.receiveTimestampsExponent,
156+
paramsB.receiveTimestampsExponent);
145157

146158
EXPECT_EQ(a.appParams, b.appParams);
147159
}

0 commit comments

Comments
 (0)