Override << for QUIC's LostPacket Struct to make failing tests easier to debug. No functional change, not flag protected.
gfe-relnote: n/a (Add << for a struct)
PiperOrigin-RevId: 244226150
Change-Id: I8ce113ba34d0ab1a17f9bde6709ce3faa22cb7a3
diff --git a/quic/core/quic_types.cc b/quic/core/quic_types.cc
index c9e21d6..102b60e 100644
--- a/quic/core/quic_types.cc
+++ b/quic/core/quic_types.cc
@@ -31,6 +31,12 @@
return os;
}
+std::ostream& operator<<(std::ostream& os, const LostPacket& lost_packet) {
+ os << "{ packet_number: " << lost_packet.packet_number
+ << ", bytes_lost: " << lost_packet.bytes_lost << "} ";
+ return os;
+}
+
std::string HistogramEnumString(WriteStatus enum_value) {
switch (enum_value) {
case WRITE_STATUS_OK:
diff --git a/quic/core/quic_types.h b/quic/core/quic_types.h
index 6f4cbe6..1b22967 100644
--- a/quic/core/quic_types.h
+++ b/quic/core/quic_types.h
@@ -476,6 +476,10 @@
LostPacket(QuicPacketNumber packet_number, QuicPacketLength bytes_lost)
: packet_number(packet_number), bytes_lost(bytes_lost) {}
+ friend QUIC_EXPORT_PRIVATE std::ostream& operator<<(
+ std::ostream& os,
+ const LostPacket& lost_packet);
+
QuicPacketNumber packet_number;
// Number of bytes sent in the packet that was lost.
QuicPacketLength bytes_lost;