Add more debug information in QuicStreamSequencer::DebugString: - First missing byte - Next expected byte - Received frames PiperOrigin-RevId: 485297419
diff --git a/quiche/quic/core/quic_stream_sequencer.cc b/quiche/quic/core/quic_stream_sequencer.cc index fa76841..540c8c7 100644 --- a/quiche/quic/core/quic_stream_sequencer.cc +++ b/quiche/quic/core/quic_stream_sequencer.cc
@@ -297,15 +297,18 @@ return NumBytesConsumed() + NumBytesBuffered() >= close_offset_; } -const std::string QuicStreamSequencer::DebugString() const { +std::string QuicStreamSequencer::DebugString() const { // clang-format off - return absl::StrCat("QuicStreamSequencer:", - "\n bytes buffered: ", NumBytesBuffered(), - "\n bytes consumed: ", NumBytesConsumed(), - "\n has bytes to read: ", HasBytesToRead() ? "true" : "false", - "\n frames received: ", num_frames_received(), - "\n close offset bytes: ", close_offset_, - "\n is closed: ", IsClosed() ? "true" : "false"); + return absl::StrCat( + "QuicStreamSequencer: bytes buffered: ", NumBytesBuffered(), + "\n bytes consumed: ", NumBytesConsumed(), + "\n first missing byte: ", buffered_frames_.FirstMissingByte(), + "\n next expected byte: ", buffered_frames_.NextExpectedByte(), + "\n received frames: ", buffered_frames_.ReceivedFramesDebugString(), + "\n has bytes to read: ", HasBytesToRead() ? "true" : "false", + "\n frames received: ", num_frames_received(), + "\n close offset bytes: ", close_offset_, + "\n is closed: ", IsClosed() ? "true" : "false"); // clang-format on }
diff --git a/quiche/quic/core/quic_stream_sequencer.h b/quiche/quic/core/quic_stream_sequencer.h index 9953c75..027b2e0 100644 --- a/quiche/quic/core/quic_stream_sequencer.h +++ b/quiche/quic/core/quic_stream_sequencer.h
@@ -162,7 +162,7 @@ void set_stream(StreamInterface* stream) { stream_ = stream; } // Returns string describing internal state. - const std::string DebugString() const; + std::string DebugString() const; private: friend class test::QuicStreamSequencerPeer;
diff --git a/quiche/quic/core/quic_stream_sequencer_buffer.h b/quiche/quic/core/quic_stream_sequencer_buffer.h index 4540db1..9b36ee1 100644 --- a/quiche/quic/core/quic_stream_sequencer_buffer.h +++ b/quiche/quic/core/quic_stream_sequencer_buffer.h
@@ -159,6 +159,15 @@ // Returns number of bytes available to be read out. size_t ReadableBytes() const; + // Returns offset of first missing byte. + QuicStreamOffset FirstMissingByte() const; + + // Returns offset of highest received byte + 1. + QuicStreamOffset NextExpectedByte() const; + + // Return all received frames as a string. + std::string ReceivedFramesDebugString() const; + private: friend class test::QuicStreamSequencerBufferPeer; @@ -198,15 +207,6 @@ // Get the index of the logical 1st block to start next read. size_t NextBlockToRead() const; - // Returns offset of first missing byte. - QuicStreamOffset FirstMissingByte() const; - - // Returns offset of highest received byte + 1. - QuicStreamOffset NextExpectedByte() const; - - // Return all received frames as a string. - std::string ReceivedFramesDebugString() const; - // Resize blocks_ if more blocks are needed to accomodate bytes before // next_expected_byte. void MaybeAddMoreBlocks(QuicStreamOffset next_expected_byte);