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

Unified Diff: net/spdy/spdy_http_stream.cc

Issue 8230037: Send PING to check the status of the SPDY connection. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 2 months 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
Index: net/spdy/spdy_http_stream.cc
===================================================================
--- net/spdy/spdy_http_stream.cc (revision 104856)
+++ net/spdy/spdy_http_stream.cc (working copy)
@@ -26,6 +26,7 @@
SpdyHttpStream::SpdyHttpStream(SpdySession* spdy_session,
bool direct)
: ALLOW_THIS_IN_INITIALIZER_LIST(read_callback_factory_(this)),
+ ALLOW_THIS_IN_INITIALIZER_LIST(ping_method_factory_(this)),
stream_(NULL),
spdy_session_(spdy_session),
response_info_(NULL),
@@ -267,11 +268,24 @@
}
bool SpdyHttpStream::OnSendHeadersComplete(int status) {
+ // Send the spdy ping message here.
+ stream_->SendPing();
+ const int kPingTimeMs = 1000;
+ MessageLoop::current()->PostDelayedTask(FROM_HERE, ping_method_factory_.
+ NewRunnableMethod(&SpdyHttpStream::CheckPingResponse),
+ kPingTimeMs);
+
if (user_callback_)
DoCallback(status);
return request_body_stream_.get() == NULL;
}
+void SpdyHttpStream::CheckPingResponse() {
+ // TODO(rtenneti): we should send a different error code.
+ if (!spdy_session_->DidLastPingWork())
+ DoCallback(ERR_CONNECTION_ABORTED);
willchan no longer on Chromium 2011/10/12 05:41:06 Need a different error code.
ramant (doing other things) 2011/10/13 21:41:14 Done.
+}
+
int SpdyHttpStream::OnSendBody() {
CHECK(request_body_stream_.get());

Powered by Google App Engine
This is Rietveld 408576698