From 155601d4ba957496202457d8c53fa45a3f7c425d Mon Sep 17 00:00:00 2001 From: "rjshade@google.com" Date: Tue, 17 Jun 2014 21:10:56 +0000 Subject: [PATCH] Log QuicGoAwayFrames and QuicPingFrames, sent and received, in net log. BUG= Review URL: https://codereview.chromium.org/338933003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@277861 0039d316-1c4b-4281-b951-d872f2087c98 --- net/base/net_log_event_type_list.h | 22 ++++++++++++++++++++++ net/quic/quic_connection.cc | 3 +++ net/quic/quic_connection.h | 3 +++ net/quic/quic_connection_logger.cc | 29 +++++++++++++++++++++++++++++ net/quic/quic_connection_logger.h | 2 ++ 5 files changed, 59 insertions(+) diff --git a/net/base/net_log_event_type_list.h b/net/base/net_log_event_type_list.h index a26b9702360b..c58aa94c6c95 100644 --- a/net/base/net_log_event_type_list.h +++ b/net/base/net_log_event_type_list.h @@ -1460,6 +1460,28 @@ EVENT_TYPE(QUIC_SESSION_BLOCKED_FRAME_RECEIVED) // } EVENT_TYPE(QUIC_SESSION_BLOCKED_FRAME_SENT) +// Session received a GOAWAY frame. +// { +// "quic_error": , +// "last_good_stream_id": , +// "reason_phrase": , +// } +EVENT_TYPE(QUIC_SESSION_GOAWAY_FRAME_RECEIVED) + +// Session sent a GOAWAY frame. +// { +// "quic_error": , +// "last_good_stream_id": , +// "reason_phrase": , +// } +EVENT_TYPE(QUIC_SESSION_GOAWAY_FRAME_SENT) + +// Session received a PING frame. +EVENT_TYPE(QUIC_SESSION_PING_FRAME_RECEIVED) + +// Session sent a PING frame. +EVENT_TYPE(QUIC_SESSION_PING_FRAME_SENT) + // Session received a STOP_WAITING frame. // { // "sent_info":
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc index d4f159361665..c7fb7c040cea 100644 --- a/net/quic/quic_connection.cc +++ b/net/quic/quic_connection.cc @@ -739,6 +739,9 @@ bool QuicConnection::OnConnectionCloseFrame( bool QuicConnection::OnGoAwayFrame(const QuicGoAwayFrame& frame) { DCHECK(connected_); + if (debug_visitor_) { + debug_visitor_->OnGoAwayFrame(frame); + } DVLOG(1) << ENDPOINT << "Go away received with error " << QuicUtils::ErrorToString(frame.error_code) << " and reason:" << frame.reason_phrase; diff --git a/net/quic/quic_connection.h b/net/quic/quic_connection.h index 35de041591a1..689d595efb7c 100644 --- a/net/quic/quic_connection.h +++ b/net/quic/quic_connection.h @@ -160,6 +160,9 @@ class NET_EXPORT_PRIVATE QuicConnectionDebugVisitor // Called when a Ping has been parsed. virtual void OnPingFrame(const QuicPingFrame& frame) {} + // Called when a GoAway has been parsed. + virtual void OnGoAwayFrame(const QuicGoAwayFrame& frame) {} + // Called when a RstStreamFrame has been parsed. virtual void OnRstStreamFrame(const QuicRstStreamFrame& frame) {} diff --git a/net/quic/quic_connection_logger.cc b/net/quic/quic_connection_logger.cc index bee8b5ccf435..86f9c6a11737 100644 --- a/net/quic/quic_connection_logger.cc +++ b/net/quic/quic_connection_logger.cc @@ -195,6 +195,16 @@ base::Value* NetLogQuicBlockedFrameCallback( return dict; } +base::Value* NetLogQuicGoAwayFrameCallback( + const QuicGoAwayFrame* frame, + NetLog::LogLevel /* log_level */) { + base::DictionaryValue* dict = new base::DictionaryValue(); + dict->SetInteger("quic_error", frame->error_code); + dict->SetInteger("last_good_stream_id", frame->last_good_stream_id); + dict->SetString("reason_phrase", frame->reason_phrase); + return dict; +} + base::Value* NetLogQuicStopWaitingFrameCallback( const QuicStopWaitingFrame* frame, NetLog::LogLevel /* log_level */) { @@ -386,6 +396,10 @@ void QuicConnectionLogger::OnFrameAddedToPacket(const QuicFrame& frame) { frame.connection_close_frame)); break; case GOAWAY_FRAME: + net_log_.AddEvent( + NetLog::TYPE_QUIC_SESSION_GOAWAY_FRAME_SENT, + base::Bind(&NetLogQuicGoAwayFrameCallback, + frame.goaway_frame)); break; case WINDOW_UPDATE_FRAME: net_log_.AddEvent( @@ -405,6 +419,10 @@ void QuicConnectionLogger::OnFrameAddedToPacket(const QuicFrame& frame) { base::Bind(&NetLogQuicStopWaitingFrameCallback, frame.stop_waiting_frame)); break; + case PING_FRAME: + // PingFrame has no contents to log, so just record that it was sent. + net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PING_FRAME_SENT); + break; default: DCHECK(false) << "Illegal frame type: " << frame.type; } @@ -578,6 +596,17 @@ void QuicConnectionLogger::OnBlockedFrame(const QuicBlockedFrame& frame) { base::Bind(&NetLogQuicBlockedFrameCallback, &frame)); } +void QuicConnectionLogger::OnGoAwayFrame(const QuicGoAwayFrame& frame) { + net_log_.AddEvent( + NetLog::TYPE_QUIC_SESSION_GOAWAY_FRAME_RECEIVED, + base::Bind(&NetLogQuicGoAwayFrameCallback, &frame)); +} + +void QuicConnectionLogger::OnPingFrame(const QuicPingFrame& frame) { + // PingFrame has no contents to log, so just record that it was received. + net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PING_FRAME_RECEIVED); +} + void QuicConnectionLogger::OnPublicResetPacket( const QuicPublicResetPacket& packet) { net_log_.AddEvent(NetLog::TYPE_QUIC_SESSION_PUBLIC_RESET_PACKET_RECEIVED); diff --git a/net/quic/quic_connection_logger.h b/net/quic/quic_connection_logger.h index 09592f750472..2110f9ef6d3b 100644 --- a/net/quic/quic_connection_logger.h +++ b/net/quic/quic_connection_logger.h @@ -53,6 +53,8 @@ class NET_EXPORT_PRIVATE QuicConnectionLogger const QuicConnectionCloseFrame& frame) OVERRIDE; virtual void OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) OVERRIDE; virtual void OnBlockedFrame(const QuicBlockedFrame& frame) OVERRIDE; + virtual void OnGoAwayFrame(const QuicGoAwayFrame& frame) OVERRIDE; + virtual void OnPingFrame(const QuicPingFrame& frame) OVERRIDE; virtual void OnPublicResetPacket( const QuicPublicResetPacket& packet) OVERRIDE; virtual void OnVersionNegotiationPacket( -- 2.11.4.GIT