diff --git a/quic/api/QuicTransportFunctions.cpp b/quic/api/QuicTransportFunctions.cpp index a35f3134b..2e2775e7a 100644 --- a/quic/api/QuicTransportFunctions.cpp +++ b/quic/api/QuicTransportFunctions.cpp @@ -2063,4 +2063,16 @@ void maybeAddPacketMark( } } +void maybeScheduleAckForCongestionFeedback( + const ReceivedUdpPacket& receivedPacket, + AckState& ackState) { + // If the packet was marked as having encountered congestion, send an ACK + // immediately to ensure timely response from the peer. + // Note that the tosValue will be populated only if the enableEcnOnEgress + // transport setting is enabled. + if ((receivedPacket.tosValue & 0b11) == 0b11) { + ackState.needsToSendAckImmediately = true; + } +} + } // namespace quic diff --git a/quic/api/QuicTransportFunctions.h b/quic/api/QuicTransportFunctions.h index 2d177065e..921871759 100644 --- a/quic/api/QuicTransportFunctions.h +++ b/quic/api/QuicTransportFunctions.h @@ -343,5 +343,7 @@ void maybeVerifyPendingKeyUpdate( void maybeAddPacketMark( QuicConnectionStateBase& conn, OutstandingPacketWrapper& op); - +void maybeScheduleAckForCongestionFeedback( + const ReceivedUdpPacket& receivedPacket, + AckState& ackState); } // namespace quic diff --git a/quic/client/QuicClientTransport.cpp b/quic/client/QuicClientTransport.cpp index 21fbe1750..a0f8e8c79 100644 --- a/quic/client/QuicClientTransport.cpp +++ b/quic/client/QuicClientTransport.cpp @@ -655,6 +655,7 @@ void QuicClientTransport::processUdpPacketData( handshakeConfirmed(*conn_); } + maybeScheduleAckForCongestionFeedback(udpPacket, ackState); maybeHandleIncomingKeyUpdate(*conn_); // Try reading bytes off of crypto, and performing a handshake. diff --git a/quic/server/state/ServerStateMachine.cpp b/quic/server/state/ServerStateMachine.cpp index c918b00bc..ac485089a 100644 --- a/quic/server/state/ServerStateMachine.cpp +++ b/quic/server/state/ServerStateMachine.cpp @@ -1297,6 +1297,7 @@ void onServerReadDataFromOpen( handshakeConfirmed(conn); } + maybeScheduleAckForCongestionFeedback(readData.udpPacket, ackState); maybeHandleIncomingKeyUpdate(conn); // Update writable limit before processing the handshake data. This is so