Skip to content

Commit

Permalink
Populate totalBytesAcked for implicit acks too
Browse files Browse the repository at this point in the history
Summary: Set totalBytesAcked in the ackEvent for implicit acks. Consumers of the AckEvent should be able to get all the available fields regardless of the type of the ackEvent.

Reviewed By: hanidamlaj

Differential Revision: D47249278

fbshipit-source-id: 45eb31a5b1b2f41f02500c9a79dc766df16303b8
  • Loading branch information
jbeshay authored and facebook-github-bot committed Jul 7, 2023
1 parent fe2a444 commit 22713e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion quic/state/AckHandlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ AckEvent processAckFrame(
}
conn.lossState.lastAckedTime = ackReceiveTime;
conn.lossState.adjustedLastAckedTime = ackReceiveTime - frame.ackDelay;
ack.totalBytesAcked = conn.lossState.totalBytesAcked;
}
ack.totalBytesAcked = conn.lossState.totalBytesAcked;

{
auto tmpIt = packetsWithHandlerContext.emplace(
Expand Down
6 changes: 5 additions & 1 deletion quic/state/test/AckHandlersTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3777,6 +3777,8 @@ TEST_P(AckHandlersTest, ImplictAckEventCreation) {
auto mockPacketProcessor = std::make_unique<MockPacketProcessor>();
auto rawPacketProcessor = mockPacketProcessor.get();
conn.packetProcessors.push_back(std::move(mockPacketProcessor));
conn.lossState.totalBytesAcked =
100; // start with some bytes acked before the implicit ack

const TimePoint startTime = Clock::now();
PacketNum packetNum = 0;
Expand Down Expand Up @@ -3844,7 +3846,9 @@ TEST_P(AckHandlersTest, ImplictAckEventCreation) {
Pointee(getAckPacketMatcher(9, getWriteCount(9), getSentTime(9))));

EXPECT_EQ(10, ack->ackedBytes);
EXPECT_EQ(0, ack->totalBytesAcked); // implicit ack
EXPECT_EQ(
100,
ack->totalBytesAcked); // implicit ack doesn't add new acked bytes
EXPECT_TRUE(ack->implicit);
EXPECT_FALSE(ack->rttSample.has_value());
EXPECT_EQ(srttBefore, conn.lossState.srtt);
Expand Down

0 comments on commit 22713e5

Please sign in to comment.