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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_SPDY_SPDY_SESSION_H_ 5 #ifndef NET_SPDY_SPDY_SESSION_H_
6 #define NET_SPDY_SPDY_SESSION_H_ 6 #define NET_SPDY_SPDY_SESSION_H_
7 #pragma once 7 #pragma once
8 8
9 #include <deque> 9 #include <deque>
10 #include <list> 10 #include <list>
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 bool is_secure, 97 bool is_secure,
98 int certificate_error_code); 98 int certificate_error_code);
99 99
100 // Check to see if this SPDY session can support an additional domain. 100 // Check to see if this SPDY session can support an additional domain.
101 // If the session is un-authenticated, then this call always returns true. 101 // If the session is un-authenticated, then this call always returns true.
102 // For SSL-based sessions, verifies that the certificate in use by this 102 // For SSL-based sessions, verifies that the certificate in use by this
103 // session provides authentication for the domain. 103 // session provides authentication for the domain.
104 // NOTE: This function can have false negatives on some platforms. 104 // NOTE: This function can have false negatives on some platforms.
105 bool VerifyDomainAuthentication(const std::string& domain); 105 bool VerifyDomainAuthentication(const std::string& domain);
106 106
107 // Send the SYN frame for |stream_id|. 107 // Send the SYN frame for |stream_id|. This also sends PING message to check
108 // the status of the connection.
108 int WriteSynStream( 109 int WriteSynStream(
109 spdy::SpdyStreamId stream_id, 110 spdy::SpdyStreamId stream_id,
110 RequestPriority priority, 111 RequestPriority priority,
111 spdy::SpdyControlFlags flags, 112 spdy::SpdyControlFlags flags,
112 const linked_ptr<spdy::SpdyHeaderBlock>& headers); 113 const linked_ptr<spdy::SpdyHeaderBlock>& headers);
113 114
114 // Write a data frame to the stream. 115 // Write a data frame to the stream.
115 // Used to create and queue a data frame for the given stream. 116 // Used to create and queue a data frame for the given stream.
116 int WriteStreamData(spdy::SpdyStreamId stream_id, net::IOBuffer* data, 117 int WriteStreamData(spdy::SpdyStreamId stream_id, net::IOBuffer* data,
117 int len, 118 int len,
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 265
265 // Control frame handlers. 266 // Control frame handlers.
266 void OnSyn(const spdy::SpdySynStreamControlFrame& frame, 267 void OnSyn(const spdy::SpdySynStreamControlFrame& frame,
267 const linked_ptr<spdy::SpdyHeaderBlock>& headers); 268 const linked_ptr<spdy::SpdyHeaderBlock>& headers);
268 void OnSynReply(const spdy::SpdySynReplyControlFrame& frame, 269 void OnSynReply(const spdy::SpdySynReplyControlFrame& frame,
269 const linked_ptr<spdy::SpdyHeaderBlock>& headers); 270 const linked_ptr<spdy::SpdyHeaderBlock>& headers);
270 void OnHeaders(const spdy::SpdyHeadersControlFrame& frame, 271 void OnHeaders(const spdy::SpdyHeadersControlFrame& frame,
271 const linked_ptr<spdy::SpdyHeaderBlock>& headers); 272 const linked_ptr<spdy::SpdyHeaderBlock>& headers);
272 void OnRst(const spdy::SpdyRstStreamControlFrame& frame); 273 void OnRst(const spdy::SpdyRstStreamControlFrame& frame);
273 void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame); 274 void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame);
275 void OnPing(const spdy::SpdyPingControlFrame& frame);
274 void OnSettings(const spdy::SpdySettingsControlFrame& frame); 276 void OnSettings(const spdy::SpdySettingsControlFrame& frame);
275 void OnWindowUpdate(const spdy::SpdyWindowUpdateControlFrame& frame); 277 void OnWindowUpdate(const spdy::SpdyWindowUpdateControlFrame& frame);
276 278
277 // IO Callbacks 279 // IO Callbacks
278 void OnReadComplete(int result); 280 void OnReadComplete(int result);
279 void OnWriteComplete(int result); 281 void OnWriteComplete(int result);
282 void OnWriteCompleteInternal(int result, bool ping_frame);
280 283
281 // Send relevant SETTINGS. This is generally called on connection setup. 284 // Send relevant SETTINGS. This is generally called on connection setup.
282 void SendSettings(); 285 void SendSettings();
283 286
284 // Handle SETTINGS. Either when we send settings, or when we receive a 287 // Handle SETTINGS. Either when we send settings, or when we receive a
285 // SETTINGS ontrol frame, update our SpdySession accordingly. 288 // SETTINGS ontrol frame, update our SpdySession accordingly.
286 void HandleSettings(const spdy::SpdySettings& settings); 289 void HandleSettings(const spdy::SpdySettings& settings);
287 290
291 // Send the PING (pre-PING and post-PING) frames for |stream_id|.
292 int SendPing(spdy::SpdyStreamId stream_id);
293
294 // Send PING if there are no PINGs in flight and we haven't heard from server.
295 int SendPrePing(spdy::SpdyStreamId stream_id);
296
297 // Send a delayed PING if there is no |follower_ping_pending_|. This PING
298 // makes sure the request has been received by the server.
299 int SendPostPing(spdy::SpdyStreamId stream_id);
300
301 // Send the PING frame for |stream_id|.
302 int WritePingFrame(spdy::SpdyStreamId stream_id);
303
304 // Check the status of the connection. It does |DeleteStream| if we haven't
305 // received any data in |kHungInterval|.
306 void CheckStatus(spdy::SpdyStreamId stream_id,
307 base::TimeTicks last_check_time);
308
288 // Start reading from the socket. 309 // Start reading from the socket.
289 // Returns OK on success, or an error on failure. 310 // Returns OK on success, or an error on failure.
290 net::Error ReadSocket(); 311 net::Error ReadSocket();
291 312
292 // Write current data to the socket. 313 // Write current data to the socket.
293 void WriteSocketLater(); 314 void WriteSocketLater();
294 void WriteSocket(); 315 void WriteSocket();
295 316
296 // Get a new stream id. 317 // Get a new stream id.
297 int GetNewStreamId(); 318 int GetNewStreamId();
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 int streams_pushed_count_; 445 int streams_pushed_count_;
425 int streams_pushed_and_claimed_count_; 446 int streams_pushed_and_claimed_count_;
426 int streams_abandoned_count_; 447 int streams_abandoned_count_;
427 int frames_received_; 448 int frames_received_;
428 int bytes_received_; 449 int bytes_received_;
429 bool sent_settings_; // Did this session send settings when it started. 450 bool sent_settings_; // Did this session send settings when it started.
430 bool received_settings_; // Did this session receive at least one settings 451 bool received_settings_; // Did this session receive at least one settings
431 // frame. 452 // frame.
432 int stalled_streams_; // Count of streams that were ever stalled. 453 int stalled_streams_; // Count of streams that were ever stalled.
433 454
455 // This list keeps track of all pings (unique_ids) that are in flight.
456 int64 pings_in_flight_;
457
458 // This is the next unique_id to be sent in PING frame.
459 uint32 unique_id_counter_;
460
461 // This is the last time we had received data.
462 base::TimeTicks received_data_time_;
463
464 // Flag if we have a pending follower ping.
465 bool follower_ping_pending_;
466
434 // Initial send window size for the session; can be changed by an 467 // Initial send window size for the session; can be changed by an
435 // arriving SETTINGS frame; newly created streams use this value for the 468 // arriving SETTINGS frame; newly created streams use this value for the
436 // initial send window size. 469 // initial send window size.
437 int initial_send_window_size_; 470 int initial_send_window_size_;
438 471
439 // Initial receive window size for the session; there are plans to add a 472 // Initial receive window size for the session; there are plans to add a
440 // command line switch that would cause a SETTINGS frame with window size 473 // command line switch that would cause a SETTINGS frame with window size
441 // announcement to be sent on startup; newly created streams will use 474 // announcement to be sent on startup; newly created streams will use
442 // this value for the initial receive window size. 475 // this value for the initial receive window size.
443 int initial_recv_window_size_; 476 int initial_recv_window_size_;
(...skipping 28 matching lines...) Expand all
472 const spdy::SpdyControlFlags flags_; 505 const spdy::SpdyControlFlags flags_;
473 const spdy::SpdyStreamId id_; 506 const spdy::SpdyStreamId id_;
474 const spdy::SpdyStreamId associated_stream_; 507 const spdy::SpdyStreamId associated_stream_;
475 508
476 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter); 509 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter);
477 }; 510 };
478 511
479 } // namespace net 512 } // namespace net
480 513
481 #endif // NET_SPDY_SPDY_SESSION_H_ 514 #endif // NET_SPDY_SPDY_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698