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

Unified Diff: net/spdy/spdy_session.h

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_session.h
===================================================================
--- net/spdy/spdy_session.h (revision 105257)
+++ net/spdy/spdy_session.h (working copy)
@@ -104,7 +104,8 @@
// NOTE: This function can have false negatives on some platforms.
bool VerifyDomainAuthentication(const std::string& domain);
- // Send the SYN frame for |stream_id|.
+ // Send the SYN frame for |stream_id|. This also sends PING message to check
+ // the status of the connection.
int WriteSynStream(
spdy::SpdyStreamId stream_id,
RequestPriority priority,
@@ -271,12 +272,14 @@
const linked_ptr<spdy::SpdyHeaderBlock>& headers);
void OnRst(const spdy::SpdyRstStreamControlFrame& frame);
void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame);
+ void OnPing(const spdy::SpdyPingControlFrame& frame);
void OnSettings(const spdy::SpdySettingsControlFrame& frame);
void OnWindowUpdate(const spdy::SpdyWindowUpdateControlFrame& frame);
// IO Callbacks
void OnReadComplete(int result);
void OnWriteComplete(int result);
+ void OnWriteCompleteInternal(int result, bool ping_frame);
// Send relevant SETTINGS. This is generally called on connection setup.
void SendSettings();
@@ -285,6 +288,24 @@
// SETTINGS ontrol frame, update our SpdySession accordingly.
void HandleSettings(const spdy::SpdySettings& settings);
+ // Send the PING (pre-PING and post-PING) frames for |stream_id|.
+ int SendPing(spdy::SpdyStreamId stream_id);
+
+ // Send PING if there are no PINGs in flight and we haven't heard from server.
+ int SendPrePing(spdy::SpdyStreamId stream_id);
+
+ // Send a delayed PING if there is no |follower_ping_pending_|. This PING
+ // makes sure the request has been received by the server.
+ int SendPostPing(spdy::SpdyStreamId stream_id);
+
+ // Send the PING frame for |stream_id|.
+ int WritePingFrame(spdy::SpdyStreamId stream_id);
+
+ // Check the status of the connection. It does |DeleteStream| if we haven't
+ // received any data in |kHungInterval|.
+ void CheckStatus(spdy::SpdyStreamId stream_id,
+ base::TimeTicks last_check_time);
+
// Start reading from the socket.
// Returns OK on success, or an error on failure.
net::Error ReadSocket();
@@ -431,6 +452,18 @@
// frame.
int stalled_streams_; // Count of streams that were ever stalled.
+ // This list keeps track of all pings (unique_ids) that are in flight.
+ int64 pings_in_flight_;
+
+ // This is the next unique_id to be sent in PING frame.
+ uint32 unique_id_counter_;
+
+ // This is the last time we had received data.
+ base::TimeTicks received_data_time_;
+
+ // Flag if we have a pending follower ping.
+ bool follower_ping_pending_;
+
// Initial send window size for the session; can be changed by an
// arriving SETTINGS frame; newly created streams use this value for the
// initial send window size.

Powered by Google App Engine
This is Rietveld 408576698