Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(730)

Unified Diff: net/quic/core/quic_framer.cc

Issue 2533303004: Add ENDPOINT macro to QuicFramer (and include in existing LOG statement output). (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_framer.cc
diff --git a/net/quic/core/quic_framer.cc b/net/quic/core/quic_framer.cc
index e8b90f945007f865dd09f7ff3ffcf5561959039c..a854a063a4b0be1008a532949eec9090a0ec24a5 100644
--- a/net/quic/core/quic_framer.cc
+++ b/net/quic/core/quic_framer.cc
@@ -35,6 +35,9 @@ namespace net {
namespace {
+#define ENDPOINT \
+ (perspective_ == Perspective::IS_SERVER ? "Server: " : "Client: ")
+
// Mask to select the lowest 48 bits of a packet number.
const QuicPacketNumber k6ByteSequenceNumberMask = UINT64_C(0x0000FFFFFFFFFFFF);
const QuicPacketNumber k4ByteSequenceNumberMask = UINT64_C(0x00000000FFFFFFFF);
@@ -305,7 +308,8 @@ size_t QuicFramer::GetSerializedFrameLength(
if (can_truncate) {
// Truncate the frame so the packet will not exceed kMaxPacketSize.
// Note that we may not use every byte of the writer in this case.
- DVLOG(1) << "Truncating large frame, free bytes: " << free_bytes;
+ DVLOG(1) << ENDPOINT
+ << "Truncating large frame, free bytes: " << free_bytes;
return free_bytes;
}
return 0;
@@ -502,7 +506,7 @@ bool QuicFramer::ProcessPacket(const QuicEncryptedPacket& packet) {
// First parse the public header.
QuicPacketPublicHeader public_header;
if (!ProcessPublicHeader(&reader, &public_header)) {
- DVLOG(1) << "Unable to process public header.";
+ DVLOG(1) << ENDPOINT << "Unable to process public header.";
DCHECK_NE("", detailed_error_);
return RaiseError(QUIC_INVALID_PACKET_HEADER);
}
@@ -569,7 +573,8 @@ bool QuicFramer::ProcessDataPacket(QuicDataReader* encrypted_reader,
size_t buffer_length) {
QuicPacketHeader header(public_header);
if (!ProcessUnauthenticatedHeader(encrypted_reader, &header)) {
- DVLOG(1) << "Unable to process packet header. Stopping parsing.";
+ DVLOG(1) << ENDPOINT
+ << "Unable to process packet header. Stopping parsing.";
return false;
}
@@ -600,7 +605,7 @@ bool QuicFramer::ProcessDataPacket(QuicDataReader* encrypted_reader,
// Handle the payload.
if (!ProcessFrameData(&reader, header)) {
DCHECK_NE(QUIC_NO_ERROR, error_); // ProcessFrameData sets the error.
- DLOG(WARNING) << "Unable to process frame data.";
+ DLOG(WARNING) << ENDPOINT << "Unable to process frame data.";
return false;
}
@@ -645,7 +650,7 @@ bool QuicFramer::ProcessPublicResetPacket(
bool QuicFramer::AppendPacketHeader(const QuicPacketHeader& header,
QuicDataWriter* writer) {
- DVLOG(1) << "Appending header: " << header;
+ DVLOG(1) << ENDPOINT << "Appending header: " << header;
uint8_t public_flags = 0;
if (header.public_header.reset_flag) {
public_flags |= PACKET_PUBLIC_FLAGS_RST;
@@ -691,7 +696,7 @@ bool QuicFramer::AppendPacketHeader(const QuicPacketHeader& header,
DCHECK_EQ(Perspective::IS_CLIENT, perspective_);
QuicTag tag = QuicVersionToQuicTag(quic_version_);
writer->WriteUInt32(tag);
- DVLOG(1) << "version = " << quic_version_ << ", tag = '"
+ DVLOG(1) << ENDPOINT << "version = " << quic_version_ << ", tag = '"
<< QuicTagToString(tag) << "'";
}
@@ -1027,7 +1032,7 @@ bool QuicFramer::ProcessFrameData(QuicDataReader* reader,
return RaiseError(QUIC_INVALID_STREAM_DATA);
}
if (!visitor_->OnStreamFrame(frame)) {
- DVLOG(1) << "Visitor asked to stop further processing.";
+ DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
// Returning true since there was no parsing error.
return true;
}
@@ -1041,7 +1046,7 @@ bool QuicFramer::ProcessFrameData(QuicDataReader* reader,
return RaiseError(QUIC_INVALID_ACK_DATA);
}
if (!visitor_->OnAckFrame(frame)) {
- DVLOG(1) << "Visitor asked to stop further processing.";
+ DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
// Returning true since there was no parsing error.
return true;
}
@@ -1051,7 +1056,8 @@ bool QuicFramer::ProcessFrameData(QuicDataReader* reader,
// This was a special frame type that did not match any
// of the known ones. Error.
set_detailed_error("Illegal frame type.");
- DLOG(WARNING) << "Illegal frame type: " << static_cast<int>(frame_type);
+ DLOG(WARNING) << ENDPOINT
+ << "Illegal frame type: " << static_cast<int>(frame_type);
return RaiseError(QUIC_INVALID_FRAME_DATA);
}
@@ -1085,7 +1091,7 @@ bool QuicFramer::ProcessFrameData(QuicDataReader* reader,
}
if (!visitor_->OnConnectionCloseFrame(frame)) {
- DVLOG(1) << "Visitor asked to stop further processing.";
+ DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
// Returning true since there was no parsing error.
return true;
}
@@ -1098,7 +1104,7 @@ bool QuicFramer::ProcessFrameData(QuicDataReader* reader,
return RaiseError(QUIC_INVALID_GOAWAY_DATA);
}
if (!visitor_->OnGoAwayFrame(goaway_frame)) {
- DVLOG(1) << "Visitor asked to stop further processing.";
+ DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
// Returning true since there was no parsing error.
return true;
}
@@ -1111,7 +1117,7 @@ bool QuicFramer::ProcessFrameData(QuicDataReader* reader,
return RaiseError(QUIC_INVALID_WINDOW_UPDATE_DATA);
}
if (!visitor_->OnWindowUpdateFrame(window_update_frame)) {
- DVLOG(1) << "Visitor asked to stop further processing.";
+ DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
// Returning true since there was no parsing error.
return true;
}
@@ -1124,7 +1130,7 @@ bool QuicFramer::ProcessFrameData(QuicDataReader* reader,
return RaiseError(QUIC_INVALID_BLOCKED_DATA);
}
if (!visitor_->OnBlockedFrame(blocked_frame)) {
- DVLOG(1) << "Visitor asked to stop further processing.";
+ DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
// Returning true since there was no parsing error.
return true;
}
@@ -1137,7 +1143,7 @@ bool QuicFramer::ProcessFrameData(QuicDataReader* reader,
return RaiseError(QUIC_INVALID_STOP_WAITING_DATA);
}
if (!visitor_->OnStopWaitingFrame(stop_waiting_frame)) {
- DVLOG(1) << "Visitor asked to stop further processing.";
+ DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
// Returning true since there was no parsing error.
return true;
}
@@ -1147,7 +1153,7 @@ bool QuicFramer::ProcessFrameData(QuicDataReader* reader,
// Ping has no payload.
QuicPingFrame ping_frame;
if (!visitor_->OnPingFrame(ping_frame)) {
- DVLOG(1) << "Visitor asked to stop further processing.";
+ DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
// Returning true since there was no parsing error.
return true;
}
@@ -1159,7 +1165,7 @@ bool QuicFramer::ProcessFrameData(QuicDataReader* reader,
return RaiseError(QUIC_INVALID_PATH_CLOSE_DATA);
}
if (!visitor_->OnPathCloseFrame(path_close_frame)) {
- DVLOG(1) << "Visitor asked to stop further processing.";
+ DVLOG(1) << ENDPOINT << "Visitor asked to stop further processing.";
// Returning true since there was no parsing error.
return true;
}
@@ -1168,7 +1174,8 @@ bool QuicFramer::ProcessFrameData(QuicDataReader* reader,
default:
set_detailed_error("Illegal frame type.");
- DLOG(WARNING) << "Illegal frame type: " << static_cast<int>(frame_type);
+ DLOG(WARNING) << ENDPOINT
+ << "Illegal frame type: " << static_cast<int>(frame_type);
return RaiseError(QUIC_INVALID_FRAME_DATA);
}
}
@@ -1668,7 +1675,7 @@ bool QuicFramer::DecryptPayload(QuicDataReader* encrypted_reader,
}
if (!success) {
- DVLOG(1) << "DecryptPacket failed for packet_number:"
+ DVLOG(1) << ENDPOINT << "DecryptPacket failed for packet_number:"
<< header.packet_number;
return false;
}
@@ -2185,7 +2192,7 @@ bool QuicFramer::AppendPathCloseFrame(const QuicPathCloseFrame& frame,
}
bool QuicFramer::RaiseError(QuicErrorCode error) {
- DVLOG(1) << "Error: " << QuicErrorCodeToString(error)
+ DVLOG(1) << ENDPOINT << "Error: " << QuicErrorCodeToString(error)
<< " detail: " << detailed_error_;
set_error(error);
visitor_->OnError(this);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698