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

Unified Diff: net/spdy/spdy_session.cc

Issue 8497063: Send preface-PING message once in 10 secs and send PING (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_session.cc
===================================================================
--- net/spdy/spdy_session.cc (revision 109371)
+++ net/spdy/spdy_session.cc (working copy)
@@ -234,7 +234,7 @@
bool SpdySession::enable_ping_based_connection_checking_ = true;
// static
-int SpdySession::connection_at_risk_of_loss_ms_ = 0;
+int SpdySession::connection_at_risk_of_loss_seconds_ = 10;
// static
int SpdySession::trailing_ping_delay_time_ms_ = 1000;
@@ -530,9 +530,10 @@
}
// Some servers don't like too many pings, so we limit our current sending to
- // no more than one ping for any syn sent. To do this, we avoid ever setting
- // this to true unless we send a syn (which we have just done). This approach
- // may change over time as servers change their responses to pings.
+ // no more than two pings for any syn frame or data frame sent. To do this,
+ // we avoid ever setting this to true unless we send a syn (which we have just
+ // done) or data frame. This approach may change over time as servers change
+ // their responses to pings.
need_to_send_ping_ = true;
return ERR_IO_PENDING;
@@ -548,8 +549,6 @@
if (!stream)
return ERR_INVALID_SPDY_STREAM;
- SendPrefacePingIfNoneInFlight();
-
if (len > kMaxSpdyFrameChunkSize) {
len = kMaxSpdyFrameChunkSize;
flags = static_cast<spdy::SpdyDataFlags>(flags & ~spdy::DATA_FLAG_FIN);
@@ -585,10 +584,23 @@
make_scoped_refptr(new NetLogSpdyDataParameter(stream_id, len, flags)));
}
+ // Send PrefacePing for DATA_FRAMEs with nonzero payload size.
+ if (len > 0)
+ SendPrefacePingIfNoneInFlight();
+
// TODO(mbelshe): reduce memory copies here.
scoped_ptr<spdy::SpdyDataFrame> frame(
spdy_framer_.CreateDataFrame(stream_id, data->data(), len, flags));
QueueFrame(frame.get(), stream->priority(), stream);
+
+ // Some servers don't like too many pings, so we limit our current sending to
+ // no more than two pings for any syn frame or data frame sent. To do this,
+ // we avoid ever setting this to true unless we send a syn (which we have just
+ // done) or data frame. This approach may change over time as servers change
+ // their responses to pings.
+ if (len > 0)
+ need_to_send_ping_ = true;
+
return ERR_IO_PENDING;
}
@@ -1540,7 +1552,7 @@
return;
const base::TimeDelta kConnectionAtRiskOfLoss =
- base::TimeDelta::FromMilliseconds(connection_at_risk_of_loss_ms_);
+ base::TimeDelta::FromSeconds(connection_at_risk_of_loss_seconds_);
base::TimeTicks now = base::TimeTicks::Now();
// If we haven't heard from server, then send a preface-PING.
@@ -1551,9 +1563,7 @@
}
void SpdySession::SendPrefacePing() {
- // TODO(rtenneti): Send preface pings when more servers support additional
- // pings.
- // WritePingFrame(next_ping_id_);
+ WritePingFrame(next_ping_id_);
}
void SpdySession::PlanToSendTrailingPing() {
« no previous file with comments | « net/spdy/spdy_session.h ('k') | net/spdy/spdy_session_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698