1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-09 10:00:57 +03:00

Clean up initial/handshake ciphers a little more intelligently.

Summary: Right now we are running the handshakeConfirmed code a lot on the client. This is excessive. We only need to run the code if we haven't already dropped the cipher.

Reviewed By: yangchi

Differential Revision: D27725974

fbshipit-source-id: ca325c132debdd280e447ca30876488b879ff13c
This commit is contained in:
Matt Joras
2021-04-13 10:10:12 -07:00
committed by Facebook GitHub Bot
parent 02d41d8ee7
commit b16c3b306b
3 changed files with 10 additions and 4 deletions

View File

@@ -1664,4 +1664,10 @@ void handshakeConfirmed(QuicConnectionStateBase& conn) {
implicitAckCryptoStream(conn, EncryptionLevel::Handshake); implicitAckCryptoStream(conn, EncryptionLevel::Handshake);
} }
bool hasInitialOrHandshakeCiphers(QuicConnectionStateBase& conn) {
return conn.initialWriteCipher || conn.handshakeWriteCipher ||
conn.readCodec->getInitialCipher() ||
conn.readCodec->getHandshakeReadCipher();
}
} // namespace quic } // namespace quic

View File

@@ -310,6 +310,7 @@ void implicitAckCryptoStream(
QuicConnectionStateBase& conn, QuicConnectionStateBase& conn,
EncryptionLevel encryptionLevel); EncryptionLevel encryptionLevel);
void handshakeConfirmed(QuicConnectionStateBase& conn); void handshakeConfirmed(QuicConnectionStateBase& conn);
bool hasInitialOrHandshakeCiphers(QuicConnectionStateBase& conn);
bool writeLoopTimeLimit( bool writeLoopTimeLimit(
TimePoint loopBeginTime, TimePoint loopBeginTime,

View File

@@ -377,9 +377,7 @@ void QuicClientTransport::processPacketData(
// finished message. We can mark the handshake as confirmed and // finished message. We can mark the handshake as confirmed and
// drop the handshake cipher and outstanding packets after the // drop the handshake cipher and outstanding packets after the
// processing loop. // processing loop.
if (conn_->handshakeWriteCipher) {
conn_->handshakeLayer->handshakeConfirmed(); conn_->handshakeLayer->handshakeConfirmed();
}
// TODO reap // TODO reap
if (*conn_->version == QuicVersion::MVFST_D24) { if (*conn_->version == QuicVersion::MVFST_D24) {
cancelHandshakeCryptoStreamRetransmissions( cancelHandshakeCryptoStreamRetransmissions(
@@ -583,7 +581,8 @@ void QuicClientTransport::processPacketData(
auto handshakeLayer = clientConn_->clientHandshakeLayer; auto handshakeLayer = clientConn_->clientHandshakeLayer;
if (handshakeLayer->getPhase() == ClientHandshake::Phase::Established && if (handshakeLayer->getPhase() == ClientHandshake::Phase::Established &&
*conn_->version != QuicVersion::MVFST_D24) { *conn_->version != QuicVersion::MVFST_D24 &&
hasInitialOrHandshakeCiphers(*conn_)) {
handshakeConfirmed(*conn_); handshakeConfirmed(*conn_);
} }