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

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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 271
271 // Control frame handlers. 272 // Control frame handlers.
272 void OnSyn(const spdy::SpdySynStreamControlFrame& frame, 273 void OnSyn(const spdy::SpdySynStreamControlFrame& frame,
273 const linked_ptr<spdy::SpdyHeaderBlock>& headers); 274 const linked_ptr<spdy::SpdyHeaderBlock>& headers);
274 void OnSynReply(const spdy::SpdySynReplyControlFrame& frame, 275 void OnSynReply(const spdy::SpdySynReplyControlFrame& frame,
275 const linked_ptr<spdy::SpdyHeaderBlock>& headers); 276 const linked_ptr<spdy::SpdyHeaderBlock>& headers);
276 void OnHeaders(const spdy::SpdyHeadersControlFrame& frame, 277 void OnHeaders(const spdy::SpdyHeadersControlFrame& frame,
277 const linked_ptr<spdy::SpdyHeaderBlock>& headers); 278 const linked_ptr<spdy::SpdyHeaderBlock>& headers);
278 void OnRst(const spdy::SpdyRstStreamControlFrame& frame); 279 void OnRst(const spdy::SpdyRstStreamControlFrame& frame);
279 void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame); 280 void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame);
281 void OnPing(const spdy::SpdyPingControlFrame& frame);
280 void OnSettings(const spdy::SpdySettingsControlFrame& frame); 282 void OnSettings(const spdy::SpdySettingsControlFrame& frame);
281 void OnWindowUpdate(const spdy::SpdyWindowUpdateControlFrame& frame); 283 void OnWindowUpdate(const spdy::SpdyWindowUpdateControlFrame& frame);
282 284
283 // IO Callbacks 285 // IO Callbacks
284 void OnReadComplete(int result); 286 void OnReadComplete(int result);
285 void OnWriteComplete(int result); 287 void OnWriteComplete(int result);
286 288
287 // Send relevant SETTINGS. This is generally called on connection setup. 289 // Send relevant SETTINGS. This is generally called on connection setup.
288 void SendSettings(); 290 void SendSettings();
289 291
290 // Handle SETTINGS. Either when we send settings, or when we receive a 292 // Handle SETTINGS. Either when we send settings, or when we receive a
291 // SETTINGS ontrol frame, update our SpdySession accordingly. 293 // SETTINGS ontrol frame, update our SpdySession accordingly.
292 void HandleSettings(const spdy::SpdySettings& settings); 294 void HandleSettings(const spdy::SpdySettings& settings);
293 295
296 // Send the PING (pre-PING and post-PING) frames for |stream_id|.
297 int SendPing(spdy::SpdyStreamId stream_id);
willchan no longer on Chromium 2011/10/13 15:47:17 SendPing() shouldn't be tied to a |stream_id|. It
ramant (doing other things) 2011/10/13 21:41:14 Dropped the stream_id argument. As you had suggest
298
299 // Send PING if there are no PINGs in flight and we haven't heard from server.
300 int SendPrePing(spdy::SpdyStreamId stream_id);
301
302 // Send a delayed PING if there is no |follower_ping_pending_|. This PING
303 // makes sure the request has been received by the server.
304 int SendPostPing(spdy::SpdyStreamId stream_id);
305
306 // Send the PING frame for |stream_id|.
307 int WritePingFrame(spdy::SpdyStreamId stream_id);
308
309 // Check the status of the connection. It does |DeleteStream| if we haven't
310 // received any data in |kHungInterval|.
311 void CheckStatus(spdy::SpdyStreamId stream_id,
312 base::TimeTicks last_check_time);
313
294 // Start reading from the socket. 314 // Start reading from the socket.
295 // Returns OK on success, or an error on failure. 315 // Returns OK on success, or an error on failure.
296 net::Error ReadSocket(); 316 net::Error ReadSocket();
297 317
298 // Write current data to the socket. 318 // Write current data to the socket.
299 void WriteSocketLater(); 319 void WriteSocketLater();
300 void WriteSocket(); 320 void WriteSocket();
301 321
302 // Get a new stream id. 322 // Get a new stream id.
303 int GetNewStreamId(); 323 int GetNewStreamId();
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 int streams_pushed_count_; 450 int streams_pushed_count_;
431 int streams_pushed_and_claimed_count_; 451 int streams_pushed_and_claimed_count_;
432 int streams_abandoned_count_; 452 int streams_abandoned_count_;
433 int frames_received_; 453 int frames_received_;
434 int bytes_received_; 454 int bytes_received_;
435 bool sent_settings_; // Did this session send settings when it started. 455 bool sent_settings_; // Did this session send settings when it started.
436 bool received_settings_; // Did this session receive at least one settings 456 bool received_settings_; // Did this session receive at least one settings
437 // frame. 457 // frame.
438 int stalled_streams_; // Count of streams that were ever stalled. 458 int stalled_streams_; // Count of streams that were ever stalled.
439 459
460 // This list keeps track of all pings (unique_ids) that are in flight.
461 int64 pings_in_flight_;
462
463 // This is the next unique_id to be sent in PING frame.
464 uint32 unique_id_counter_;
465
466 // This is the last time we had received data.
467 base::TimeTicks received_data_time_;
468
469 // Flag if we have a pending follower ping.
470 bool follower_ping_pending_;
471
440 // Initial send window size for the session; can be changed by an 472 // Initial send window size for the session; can be changed by an
441 // arriving SETTINGS frame; newly created streams use this value for the 473 // arriving SETTINGS frame; newly created streams use this value for the
442 // initial send window size. 474 // initial send window size.
443 int initial_send_window_size_; 475 int initial_send_window_size_;
444 476
445 // Initial receive window size for the session; there are plans to add a 477 // Initial receive window size for the session; there are plans to add a
446 // command line switch that would cause a SETTINGS frame with window size 478 // command line switch that would cause a SETTINGS frame with window size
447 // announcement to be sent on startup; newly created streams will use 479 // announcement to be sent on startup; newly created streams will use
448 // this value for the initial receive window size. 480 // this value for the initial receive window size.
449 int initial_recv_window_size_; 481 int initial_recv_window_size_;
(...skipping 29 matching lines...) Expand all
479 const spdy::SpdyControlFlags flags_; 511 const spdy::SpdyControlFlags flags_;
480 const spdy::SpdyStreamId id_; 512 const spdy::SpdyStreamId id_;
481 const spdy::SpdyStreamId associated_stream_; 513 const spdy::SpdyStreamId associated_stream_;
482 514
483 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter); 515 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter);
484 }; 516 };
485 517
486 } // namespace net 518 } // namespace net
487 519
488 #endif // NET_SPDY_SPDY_SESSION_H_ 520 #endif // NET_SPDY_SPDY_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698