Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
quic: add ToString to QuicHeader in prep for FPrintF
Browse files Browse the repository at this point in the history
PR-URL: #294
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
jasnell committed Jan 23, 2020
1 parent cdac96d commit 1ec0ffd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/quic/node_quic_stream-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ void QuicStream::Unschedule() {
stream_queue_.Remove();
}

std::string QuicHeader::ToString() {
return name() + " = " + value();
}

} // namespace quic
} // namespace node

Expand Down
3 changes: 2 additions & 1 deletion src/quic/node_quic_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <array>
#include <algorithm>
#include <limits>
#include <string>

namespace node {

Expand Down Expand Up @@ -101,7 +102,6 @@ void QuicStream::Acknowledge(uint64_t offset, size_t datalen) {
// While not all QUIC applications will support headers, QuicStream
// includes basic, generic support for storing them.
bool QuicStream::AddHeader(std::unique_ptr<QuicHeader> header) {
Debug(this, "Header Added");
size_t len = header->length();
QuicApplication* app = session()->application();
// We cannot add the header if we've either reached
Expand All @@ -113,6 +113,7 @@ bool QuicStream::AddHeader(std::unique_ptr<QuicHeader> header) {
}

current_headers_length_ += header->length();
Debug(this, "Header - %s", header->ToString().c_str());
headers_.emplace_back(std::move(header));
return true;
}
Expand Down
2 changes: 2 additions & 0 deletions src/quic/node_quic_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class QuicHeader : public MemoryRetainer {
// Returns the total length of the header in bytes
// (including the name and value)
virtual size_t length() const = 0;

inline std::string ToString();
};

enum QuicStreamStates : uint32_t {
Expand Down

0 comments on commit 1ec0ffd

Please sign in to comment.