OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 // reasonably with ethernet. Chop the world into 2-packet chunks. This is | 42 // reasonably with ethernet. Chop the world into 2-packet chunks. This is |
43 // somewhat arbitrary, but is reasonably small and ensures that we elicit | 43 // somewhat arbitrary, but is reasonably small and ensures that we elicit |
44 // ACKs quickly from TCP (because TCP tries to only ACK every other packet). | 44 // ACKs quickly from TCP (because TCP tries to only ACK every other packet). |
45 const int kMss = 1430; | 45 const int kMss = 1430; |
46 const int kMaxSpdyFrameChunkSize = (2 * kMss) - SpdyFrame::kHeaderSize; | 46 const int kMaxSpdyFrameChunkSize = (2 * kMss) - SpdyFrame::kHeaderSize; |
47 | 47 |
48 class BoundNetLog; | 48 class BoundNetLog; |
49 class SpdyStream; | 49 class SpdyStream; |
50 class SSLInfo; | 50 class SSLInfo; |
51 | 51 |
52 enum SpdySessionErrorDetails { | |
53 // SpdyFramer::SpdyErrors | |
54 SPDY_NO_ERROR, | |
55 SPDY_INVALID_CONTROL_FRAME, // Control frame is mal-formatted. | |
56 SPDY_CONTROL_PAYLOAD_TOO_LARGE, // Control frame payload was too large. | |
57 SPDY_ZLIB_INIT_FAILURE, // The Zlib library could not initialize. | |
58 SPDY_UNSUPPORTED_VERSION, // Control frame has unsupported version. | |
59 SPDY_DECOMPRESS_FAILURE, // There was an error decompressing. | |
60 SPDY_COMPRESS_FAILURE, // There was an error compressing. | |
61 SPDY_CREDENTIAL_FRAME_CORRUPT, // CREDENTIAL frame could not be parsed. | |
62 SPDY_INVALID_DATA_FRAME_FLAGS, // Data frame has invalid flags. | |
63 | |
64 // SpdySession errors | |
65 UNEXPECTED_PING, | |
66 PING_FAILED, | |
67 SPDY_COMPRESSION_FAILURE, | |
68 REQUST_FOR_SECURE_CONTENT_OVER_INSECURE_SESSION, | |
willchan no longer on Chromium
2012/04/27 21:59:30
REQUEST
| |
69 READ_FAILED, | |
70 WRITE_FAILED, | |
71 NUM_SPDY_SESSION_ERROR_DETAILS | |
72 }; | |
73 | |
74 COMPILE_ASSERT(static_cast<SpdySessionErrorDetails>(SpdyFramer::LAST_ERROR) == | |
willchan no longer on Chromium
2012/04/27 21:59:30
include compiler_specific.h for this
| |
75 UNEXPECTED_PING, | |
76 SpdySessionErrorDetails_SpdyErrors_mismatch); | |
77 | |
52 class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, | 78 class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, |
53 public BufferedSpdyFramerVisitorInterface { | 79 public BufferedSpdyFramerVisitorInterface { |
54 public: | 80 public: |
55 // Create a new SpdySession. | 81 // Create a new SpdySession. |
56 // |host_port_proxy_pair| is the host/port that this session connects to, and | 82 // |host_port_proxy_pair| is the host/port that this session connects to, and |
57 // the proxy configuration settings that it's using. | 83 // the proxy configuration settings that it's using. |
58 // |spdy_session_pool| is the SpdySessionPool that owns us. Its lifetime must | 84 // |spdy_session_pool| is the SpdySessionPool that owns us. Its lifetime must |
59 // strictly be greater than |this|. | 85 // strictly be greater than |this|. |
60 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log | 86 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log |
61 // network events to. | 87 // network events to. |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 bool IsClosed() const { return state_ == CLOSED; } | 225 bool IsClosed() const { return state_ == CLOSED; } |
200 | 226 |
201 // Closes this session. This will close all active streams and mark | 227 // Closes this session. This will close all active streams and mark |
202 // the session as permanently closed. | 228 // the session as permanently closed. |
203 // |err| should not be OK; this function is intended to be called on | 229 // |err| should not be OK; this function is intended to be called on |
204 // error. | 230 // error. |
205 // |remove_from_pool| indicates whether to also remove the session from the | 231 // |remove_from_pool| indicates whether to also remove the session from the |
206 // session pool. | 232 // session pool. |
207 // |description| indicates the reason for the error. | 233 // |description| indicates the reason for the error. |
208 void CloseSessionOnError(net::Error err, | 234 void CloseSessionOnError(net::Error err, |
235 SpdySessionErrorDetails details, | |
209 bool remove_from_pool, | 236 bool remove_from_pool, |
210 const std::string& description); | 237 const std::string& description); |
211 | 238 |
212 // Retrieves information on the current state of the SPDY session as a | 239 // Retrieves information on the current state of the SPDY session as a |
213 // Value. Caller takes possession of the returned value. | 240 // Value. Caller takes possession of the returned value. |
214 base::Value* GetInfoAsValue() const; | 241 base::Value* GetInfoAsValue() const; |
215 | 242 |
216 // Indicates whether the session is being reused after having successfully | 243 // Indicates whether the session is being reused after having successfully |
217 // used to send/receive data in the past. | 244 // used to send/receive data in the past. |
218 bool IsReused() const; | 245 bool IsReused() const; |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
422 void RecordHistograms(); | 449 void RecordHistograms(); |
423 | 450 |
424 // Closes all streams. Used as part of shutdown. | 451 // Closes all streams. Used as part of shutdown. |
425 void CloseAllStreams(net::Error status); | 452 void CloseAllStreams(net::Error status); |
426 | 453 |
427 // Invokes a user callback for stream creation. We provide this method so it | 454 // Invokes a user callback for stream creation. We provide this method so it |
428 // can be deferred to the MessageLoop, so we avoid re-entrancy problems. | 455 // can be deferred to the MessageLoop, so we avoid re-entrancy problems. |
429 void InvokeUserStreamCreationCallback(scoped_refptr<SpdyStream>* stream); | 456 void InvokeUserStreamCreationCallback(scoped_refptr<SpdyStream>* stream); |
430 | 457 |
431 // BufferedSpdyFramerVisitorInterface: | 458 // BufferedSpdyFramerVisitorInterface: |
432 virtual void OnError(int error_code) OVERRIDE; | 459 virtual void OnError(SpdyFramer::SpdyError error_code) OVERRIDE; |
433 virtual void OnStreamError(SpdyStreamId stream_id, | 460 virtual void OnStreamError(SpdyStreamId stream_id, |
434 const std::string& description) OVERRIDE; | 461 const std::string& description) OVERRIDE; |
435 virtual void OnRstStream( | 462 virtual void OnRstStream( |
436 const SpdyRstStreamControlFrame& frame) OVERRIDE; | 463 const SpdyRstStreamControlFrame& frame) OVERRIDE; |
437 virtual void OnGoAway(const SpdyGoAwayControlFrame& frame) OVERRIDE; | 464 virtual void OnGoAway(const SpdyGoAwayControlFrame& frame) OVERRIDE; |
438 virtual void OnPing(const SpdyPingControlFrame& frame) OVERRIDE; | 465 virtual void OnPing(const SpdyPingControlFrame& frame) OVERRIDE; |
439 virtual void OnWindowUpdate( | 466 virtual void OnWindowUpdate( |
440 const SpdyWindowUpdateControlFrame& frame) OVERRIDE; | 467 const SpdyWindowUpdateControlFrame& frame) OVERRIDE; |
441 virtual void OnStreamFrameData(SpdyStreamId stream_id, | 468 virtual void OnStreamFrameData(SpdyStreamId stream_id, |
442 const char* data, | 469 const char* data, |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
701 | 728 |
702 const int status_; | 729 const int status_; |
703 const std::string description_; | 730 const std::string description_; |
704 | 731 |
705 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); | 732 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); |
706 }; | 733 }; |
707 | 734 |
708 } // namespace net | 735 } // namespace net |
709 | 736 |
710 #endif // NET_SPDY_SPDY_SESSION_H_ | 737 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |