Commit 1b1613a0 authored by rtenneti@chromium.org's avatar rtenneti@chromium.org

SPDY PING - log the type of PING if it is received

or sent ping (like below):

t=1323200233634 [st=196851]     SPDY_SESSION_PING
                                --> type = "sent"
                                --> unique_id = 3
t=1323200233638 [st=196855]     SPDY_SESSION_PING
                                --> type = "received"
                                --> unique_id = 3
BUG=106499
R=willchan
TEST=spdy unit tests

Review URL: http://codereview.chromium.org/8824005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113295 0039d316-1c4b-4281-b951-d872f2087c98
parent b43a8979
...@@ -952,6 +952,7 @@ EVENT_TYPE(SPDY_SESSION_SEND_RST_STREAM) ...@@ -952,6 +952,7 @@ EVENT_TYPE(SPDY_SESSION_SEND_RST_STREAM)
// The following parameters are attached: // The following parameters are attached:
// { // {
// "unique_id": <The unique id of the PING message>, // "unique_id": <The unique id of the PING message>,
// "type": <The PING type ("sent", "received")>,
// } // }
EVENT_TYPE(SPDY_SESSION_PING) EVENT_TYPE(SPDY_SESSION_PING)
......
...@@ -175,17 +175,21 @@ class NetLogSpdyRstParameter : public NetLog::EventParameters { ...@@ -175,17 +175,21 @@ class NetLogSpdyRstParameter : public NetLog::EventParameters {
class NetLogSpdyPingParameter : public NetLog::EventParameters { class NetLogSpdyPingParameter : public NetLog::EventParameters {
public: public:
explicit NetLogSpdyPingParameter(uint32 unique_id) : unique_id_(unique_id) {} explicit NetLogSpdyPingParameter(uint32 unique_id, const std::string& type)
: unique_id_(unique_id),
type_(type) {}
virtual Value* ToValue() const { virtual Value* ToValue() const {
DictionaryValue* dict = new DictionaryValue(); DictionaryValue* dict = new DictionaryValue();
dict->SetInteger("unique_id", unique_id_); dict->SetInteger("unique_id", unique_id_);
dict->SetString("type", type_);
return dict; return dict;
} }
private: private:
~NetLogSpdyPingParameter() {} ~NetLogSpdyPingParameter() {}
const uint32 unique_id_; const uint32 unique_id_;
const std::string type_;
DISALLOW_COPY_AND_ASSIGN(NetLogSpdyPingParameter); DISALLOW_COPY_AND_ASSIGN(NetLogSpdyPingParameter);
}; };
...@@ -1382,7 +1386,8 @@ void SpdySession::OnGoAway(const spdy::SpdyGoAwayControlFrame& frame) { ...@@ -1382,7 +1386,8 @@ void SpdySession::OnGoAway(const spdy::SpdyGoAwayControlFrame& frame) {
void SpdySession::OnPing(const spdy::SpdyPingControlFrame& frame) { void SpdySession::OnPing(const spdy::SpdyPingControlFrame& frame) {
net_log_.AddEvent( net_log_.AddEvent(
NetLog::TYPE_SPDY_SESSION_PING, NetLog::TYPE_SPDY_SESSION_PING,
make_scoped_refptr(new NetLogSpdyPingParameter(frame.unique_id()))); make_scoped_refptr(
new NetLogSpdyPingParameter(frame.unique_id(), "received")));
// Send response to a PING from server. // Send response to a PING from server.
if (frame.unique_id() % 2 == 0) { if (frame.unique_id() % 2 == 0) {
...@@ -1593,7 +1598,7 @@ void SpdySession::WritePingFrame(uint32 unique_id) { ...@@ -1593,7 +1598,7 @@ void SpdySession::WritePingFrame(uint32 unique_id) {
if (net_log().IsLoggingAllEvents()) { if (net_log().IsLoggingAllEvents()) {
net_log().AddEvent( net_log().AddEvent(
NetLog::TYPE_SPDY_SESSION_PING, NetLog::TYPE_SPDY_SESSION_PING,
make_scoped_refptr(new NetLogSpdyPingParameter(next_ping_id_))); make_scoped_refptr(new NetLogSpdyPingParameter(next_ping_id_, "sent")));
} }
if (unique_id % 2 != 0) { if (unique_id % 2 != 0) {
next_ping_id_ += 2; next_ping_id_ += 2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment