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

Introduce OptionalIntegral and OptionalMicros

Summary: We have a lot of optionals that are either integral values or std::chrono::microseconds. These end up wasting memory, where we can instead store sentinel values to encode whether the value is there or not. This reduces the effective range of the type by one value, but that is an acceptable tradeoff.

Reviewed By: kvtsoy

Differential Revision: D57684368

fbshipit-source-id: b406b86011f9b8169b6e5e925265f4829928cc63
This commit is contained in:
Matt Joras
2024-06-11 11:02:02 -07:00
committed by Facebook GitHub Bot
parent 466a0649a1
commit e903f277da
45 changed files with 211 additions and 173 deletions

View File

@ -1470,7 +1470,7 @@ WriteQuicDataResult writeConnectionDataToSocket(
<< " writing data using scheduler=" << scheduler.name() << " "
<< connection;
if (!connection.gsoSupported.hasValue()) {
if (!connection.gsoSupported.has_value()) {
connection.gsoSupported = sock.getGSO() >= 0;
if (!*connection.gsoSupported) {
if (!useSinglePacketInplaceBatchWriter(
@ -1988,7 +1988,7 @@ void maybeInitiateKeyUpdate(QuicConnectionStateBase& conn) {
conn.readCodec->canInitiateKeyUpdate()) {
QUIC_STATS(conn.statsCallback, onKeyUpdateAttemptInitiated);
conn.readCodec->advanceOneRttReadPhase();
conn.transportSettings.firstKeyUpdatePacketCount.clear();
conn.transportSettings.firstKeyUpdatePacketCount.reset();
updateOneRttWriteCipher(
conn,
@ -1998,7 +1998,7 @@ void maybeInitiateKeyUpdate(QuicConnectionStateBase& conn) {
conn.handshakeLayer->getNextOneRttReadCipher());
// Signal the transport that a key update has been initiated.
conn.oneRttWritePendingVerification = true;
conn.oneRttWritePendingVerificationPacketNumber.clear();
conn.oneRttWritePendingVerificationPacketNumber.reset();
}
}
}
@ -2021,7 +2021,7 @@ void maybeVerifyPendingKeyUpdate(
// the current phase.
if (ackPacket.header.getProtectionType() == conn.oneRttWritePhase) {
// Key update is verified.
conn.oneRttWritePendingVerificationPacketNumber.clear();
conn.oneRttWritePendingVerificationPacketNumber.reset();
conn.oneRttWritePendingVerification = false;
} else {
throw QuicTransportException(