Skip to content

Commit

Permalink
Improve server packet drop logging.
Browse files Browse the repository at this point in the history
Summary:
Provide a more detailed reason why we dropped a packet to the stats
callback and qlog.

Reviewed By: hanidamlaj

Differential Revision: D66171930

fbshipit-source-id: 4cf10b149d1184afb7b268ac8f229555d2ffb75d
  • Loading branch information
Kyle Nekritz authored and facebook-github-bot committed Nov 20, 2024
1 parent df29c69 commit abb06d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
18 changes: 10 additions & 8 deletions quic/server/state/ServerStateMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,14 +886,16 @@ void onServerReadDataFromOpen(
break;
}
case CodecResult::Type::NOTHING: {
VLOG(10) << "drop cipher unavailable, no data " << conn;
VLOG(10) << "drop no data, reason: "
<< parsedPacket.nothing()->reason._to_string() << " " << conn;
if (conn.qLogger) {
conn.qLogger->addPacketDrop(packetSize, kCipherUnavailable);
conn.qLogger->addPacketDrop(
packetSize, parsedPacket.nothing()->reason._to_string());
}
QUIC_STATS(
conn.statsCallback,
onPacketDropped,
PacketDropReason::UNEXPECTED_NOTHING);
parsedPacket.nothing()->reason);
if (firstPacketFromPeer) {
throw QuicInternalException(
"Failed to decrypt first packet from peer",
Expand Down Expand Up @@ -1455,14 +1457,14 @@ void onServerReadDataFromClosed(
break;
}
case CodecResult::Type::NOTHING: {
VLOG(10) << "drop cipher unavailable, no data " << conn;
VLOG(10) << "drop no data, reason: "
<< parsedPacket.nothing()->reason._to_string() << " " << conn;
if (conn.qLogger) {
conn.qLogger->addPacketDrop(packetSize, kCipherUnavailable);
conn.qLogger->addPacketDrop(
packetSize, parsedPacket.nothing()->reason._to_string());
}
QUIC_STATS(
conn.statsCallback,
onPacketDropped,
PacketDropReason::UNEXPECTED_NOTHING);
conn.statsCallback, onPacketDropped, parsedPacket.nothing()->reason);
break;
}
case CodecResult::Type::REGULAR_PACKET:
Expand Down
2 changes: 1 addition & 1 deletion quic/server/test/QuicServerTransportTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3570,7 +3570,7 @@ TEST_F(QuicUnencryptedServerTransportTest, TestUnencryptedAck) {
auto tmp = std::move(qLogger->logs[indices[0]]);
auto event = dynamic_cast<QLogPacketDropEvent*>(tmp.get());
EXPECT_EQ(event->packetSize, 45);
EXPECT_EQ(event->dropReason, kCipherUnavailable);
EXPECT_EQ(event->dropReason, "DECRYPTION_ERROR_INITIAL");
}

TEST_F(QuicUnencryptedServerTransportTest, TestBadPacketProtectionLevel) {
Expand Down

0 comments on commit abb06d9

Please sign in to comment.