OLD | NEW |
---|---|
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 Loading... | |
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 PING frame for |stream_id|. | |
108 int WritePingFrame(spdy::SpdyStreamId stream_id); | |
109 | |
107 // Send the SYN frame for |stream_id|. | 110 // Send the SYN frame for |stream_id|. |
108 int WriteSynStream( | 111 int WriteSynStream( |
109 spdy::SpdyStreamId stream_id, | 112 spdy::SpdyStreamId stream_id, |
110 RequestPriority priority, | 113 RequestPriority priority, |
111 spdy::SpdyControlFlags flags, | 114 spdy::SpdyControlFlags flags, |
112 const linked_ptr<spdy::SpdyHeaderBlock>& headers); | 115 const linked_ptr<spdy::SpdyHeaderBlock>& headers); |
113 | 116 |
114 // Write a data frame to the stream. | 117 // Write a data frame to the stream. |
115 // Used to create and queue a data frame for the given stream. | 118 // Used to create and queue a data frame for the given stream. |
116 int WriteStreamData(spdy::SpdyStreamId stream_id, net::IOBuffer* data, | 119 int WriteStreamData(spdy::SpdyStreamId stream_id, net::IOBuffer* data, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 | 191 |
189 void set_spdy_session_pool(SpdySessionPool* pool) { | 192 void set_spdy_session_pool(SpdySessionPool* pool) { |
190 spdy_session_pool_ = NULL; | 193 spdy_session_pool_ = NULL; |
191 } | 194 } |
192 | 195 |
193 // Returns true if session is not currently active | 196 // Returns true if session is not currently active |
194 bool is_active() const { | 197 bool is_active() const { |
195 return !active_streams_.empty(); | 198 return !active_streams_.empty(); |
196 } | 199 } |
197 | 200 |
201 // Returns true if we have received a ping response from server for the ping | |
202 // message we had sent. | |
203 bool DidLastPingWork() const { | |
204 if (sent_ping_) | |
willchan no longer on Chromium
2011/10/12 05:41:06
This isn't good enough, you're going to need to tr
ramant (doing other things)
2011/10/13 21:41:14
Done.
| |
205 return received_ping_; | |
206 return true; | |
207 } | |
208 | |
198 // Access to the number of active and pending streams. These are primarily | 209 // Access to the number of active and pending streams. These are primarily |
199 // available for testing and diagnostics. | 210 // available for testing and diagnostics. |
200 size_t num_active_streams() const { return active_streams_.size(); } | 211 size_t num_active_streams() const { return active_streams_.size(); } |
201 size_t num_unclaimed_pushed_streams() const { | 212 size_t num_unclaimed_pushed_streams() const { |
202 return unclaimed_pushed_streams_.size(); | 213 return unclaimed_pushed_streams_.size(); |
203 } | 214 } |
204 | 215 |
205 const BoundNetLog& net_log() const { return net_log_; } | 216 const BoundNetLog& net_log() const { return net_log_; } |
206 | 217 |
207 int GetPeerAddress(AddressList* address) const; | 218 int GetPeerAddress(AddressList* address) const; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 | 275 |
265 // Control frame handlers. | 276 // Control frame handlers. |
266 void OnSyn(const spdy::SpdySynStreamControlFrame& frame, | 277 void OnSyn(const spdy::SpdySynStreamControlFrame& frame, |
267 const linked_ptr<spdy::SpdyHeaderBlock>& headers); | 278 const linked_ptr<spdy::SpdyHeaderBlock>& headers); |
268 void OnSynReply(const spdy::SpdySynReplyControlFrame& frame, | 279 void OnSynReply(const spdy::SpdySynReplyControlFrame& frame, |
269 const linked_ptr<spdy::SpdyHeaderBlock>& headers); | 280 const linked_ptr<spdy::SpdyHeaderBlock>& headers); |
270 void OnHeaders(const spdy::SpdyHeadersControlFrame& frame, | 281 void OnHeaders(const spdy::SpdyHeadersControlFrame& frame, |
271 const linked_ptr<spdy::SpdyHeaderBlock>& headers); | 282 const linked_ptr<spdy::SpdyHeaderBlock>& headers); |
272 void OnRst(const spdy::SpdyRstStreamControlFrame& frame); | 283 void OnRst(const spdy::SpdyRstStreamControlFrame& frame); |
273 void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame); | 284 void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame); |
285 void OnPing(const spdy::SpdyPingControlFrame& frame); | |
274 void OnSettings(const spdy::SpdySettingsControlFrame& frame); | 286 void OnSettings(const spdy::SpdySettingsControlFrame& frame); |
275 void OnWindowUpdate(const spdy::SpdyWindowUpdateControlFrame& frame); | 287 void OnWindowUpdate(const spdy::SpdyWindowUpdateControlFrame& frame); |
276 | 288 |
277 // IO Callbacks | 289 // IO Callbacks |
278 void OnReadComplete(int result); | 290 void OnReadComplete(int result); |
279 void OnWriteComplete(int result); | 291 void OnWriteComplete(int result); |
280 | 292 |
281 // Send relevant SETTINGS. This is generally called on connection setup. | 293 // Send relevant SETTINGS. This is generally called on connection setup. |
282 void SendSettings(); | 294 void SendSettings(); |
283 | 295 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
424 int streams_pushed_count_; | 436 int streams_pushed_count_; |
425 int streams_pushed_and_claimed_count_; | 437 int streams_pushed_and_claimed_count_; |
426 int streams_abandoned_count_; | 438 int streams_abandoned_count_; |
427 int frames_received_; | 439 int frames_received_; |
428 int bytes_received_; | 440 int bytes_received_; |
429 bool sent_settings_; // Did this session send settings when it started. | 441 bool sent_settings_; // Did this session send settings when it started. |
430 bool received_settings_; // Did this session receive at least one settings | 442 bool received_settings_; // Did this session receive at least one settings |
431 // frame. | 443 // frame. |
432 int stalled_streams_; // Count of streams that were ever stalled. | 444 int stalled_streams_; // Count of streams that were ever stalled. |
433 | 445 |
446 bool sent_ping_; // Did this session send a ping message. | |
447 bool received_ping_; // Did this session receive a ping message. | |
448 | |
434 // Initial send window size for the session; can be changed by an | 449 // Initial send window size for the session; can be changed by an |
435 // arriving SETTINGS frame; newly created streams use this value for the | 450 // arriving SETTINGS frame; newly created streams use this value for the |
436 // initial send window size. | 451 // initial send window size. |
437 int initial_send_window_size_; | 452 int initial_send_window_size_; |
438 | 453 |
439 // Initial receive window size for the session; there are plans to add a | 454 // 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 | 455 // command line switch that would cause a SETTINGS frame with window size |
441 // announcement to be sent on startup; newly created streams will use | 456 // announcement to be sent on startup; newly created streams will use |
442 // this value for the initial receive window size. | 457 // this value for the initial receive window size. |
443 int initial_recv_window_size_; | 458 int initial_recv_window_size_; |
(...skipping 28 matching lines...) Expand all Loading... | |
472 const spdy::SpdyControlFlags flags_; | 487 const spdy::SpdyControlFlags flags_; |
473 const spdy::SpdyStreamId id_; | 488 const spdy::SpdyStreamId id_; |
474 const spdy::SpdyStreamId associated_stream_; | 489 const spdy::SpdyStreamId associated_stream_; |
475 | 490 |
476 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter); | 491 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter); |
477 }; | 492 }; |
478 | 493 |
479 } // namespace net | 494 } // namespace net |
480 | 495 |
481 #endif // NET_SPDY_SPDY_SESSION_H_ | 496 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |