Skip to content

Commit

Permalink
Fix buffered data case for initial / handshake
Browse files Browse the repository at this point in the history
Summary: This case was missing. If we don't do this then if we buffer a packet on EAGAIN while we don't have initia/handshake data to write, we will loop on the write callback and do empty write loops.

Reviewed By: kvtsoy

Differential Revision: D63492172

fbshipit-source-id: 94ac1c37b2015d38694b9aa3be2744c9bbbe6bee
  • Loading branch information
Matt Joras authored and facebook-github-bot committed Sep 28, 2024
1 parent 39ed684 commit 3f21e71
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions quic/api/QuicTransportBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4034,7 +4034,8 @@ WriteQuicDataResult QuicTransportBase::handleInitialWriteDataCommon(
if ((initialCryptoStream.retransmissionBuffer.size() &&
conn_->outstandings.packetCount[PacketNumberSpace::Initial] &&
numProbePackets) ||
initialScheduler.hasData() || toWriteInitialAcks(*conn_)) {
initialScheduler.hasData() || toWriteInitialAcks(*conn_) ||
hasBufferedDataToWrite(*conn_)) {
CHECK(conn_->initialHeaderCipher);
return writeCryptoAndAckDataToSocket(
*socket_,
Expand Down Expand Up @@ -4064,7 +4065,8 @@ WriteQuicDataResult QuicTransportBase::handleHandshakeWriteDataCommon(
conn_->pendingEvents.numProbePackets[PacketNumberSpace::Handshake];
if ((conn_->outstandings.packetCount[PacketNumberSpace::Handshake] &&
handshakeCryptoStream.retransmissionBuffer.size() && numProbePackets) ||
handshakeScheduler.hasData() || toWriteHandshakeAcks(*conn_)) {
handshakeScheduler.hasData() || toWriteHandshakeAcks(*conn_) ||
hasBufferedDataToWrite(*conn_)) {
CHECK(conn_->handshakeWriteHeaderCipher);
return writeCryptoAndAckDataToSocket(
*socket_,
Expand Down

0 comments on commit 3f21e71

Please sign in to comment.