1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-07-30 14:43:05 +03:00

Support transport isPriming

Summary:
When the transport is in priming mode it saves all packets instead of writing them on the wire, and feeds them to a callback for the caller to get the data.

Meta:
Priming mode is used to get all packets before 1-RTT cipher is available, in order for them to get replayed later.

Reviewed By: kvtsoy

Differential Revision: D71290230

fbshipit-source-id: 230650cb1e5901069dda4ef850c9c724bf33b6be
This commit is contained in:
Paul Farcasanu
2025-05-07 09:32:06 -07:00
committed by Facebook GitHub Bot
parent 469da60216
commit c6a141bf80
13 changed files with 163 additions and 2 deletions

View File

@ -327,6 +327,14 @@ continuousMemoryBuildScheduleEncrypt(
auto encodedBodySize = encodedSize - headerLen;
// Include previous packets back.
packetBuf->prepend(prevSize);
if (connection.transportSettings.isPriming && packetBuf) {
packetBuf->coalesce();
connection.bufAccessor->release(
folly::IOBuf::create(packetBuf->capacity()));
connection.primingData_.emplace_back(std::move(packetBuf));
return DataPathResult::makeWriteResult(
true, std::move(result.value()), encodedSize, encodedBodySize);
}
connection.bufAccessor->release(std::move(packetBuf));
if (encodedSize > connection.udpSendPacketLen) {
VLOG(3) << "Quic sending pkt larger than limit, encodedSize="
@ -424,6 +432,12 @@ iobufChainBasedBuildScheduleEncrypt(
VLOG(3) << "Quic sending pkt larger than limit, encodedSize=" << encodedSize
<< " encodedBodySize=" << encodedBodySize;
}
if (connection.transportSettings.isPriming && packetBuf) {
packetBuf->coalesce();
connection.primingData_.emplace_back(std::move(packetBuf));
return DataPathResult::makeWriteResult(
true, std::move(result.value()), encodedSize, encodedBodySize);
}
auto writeResult = ioBufBatch.write(std::move(packetBuf), encodedSize);
if (writeResult.hasError()) {
return folly::makeUnexpected(writeResult.error());