[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 1 | // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | dab9c7d | 2010-02-06 21:44:32 | [diff] [blame] | 5 | #ifndef NET_SPDY_SPDY_SESSION_H_ |
| 6 | #define NET_SPDY_SPDY_SESSION_H_ |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 7 | |
| 8 | #include <deque> |
| 9 | #include <list> |
| 10 | #include <map> |
| 11 | #include <queue> |
| 12 | #include <string> |
| 13 | |
[email protected] | 33c477b | 2010-05-13 19:21:07 | [diff] [blame] | 14 | #include "base/linked_ptr.h" |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 15 | #include "base/ref_counted.h" |
| 16 | #include "net/base/io_buffer.h" |
| 17 | #include "net/base/load_states.h" |
| 18 | #include "net/base/net_errors.h" |
[email protected] | 635909f | 2010-05-12 18:19:36 | [diff] [blame] | 19 | #include "net/base/net_log.h" |
[email protected] | ac790b4 | 2009-12-02 04:31:31 | [diff] [blame] | 20 | #include "net/base/request_priority.h" |
[email protected] | 18c53ae | 2009-10-01 18:18:52 | [diff] [blame] | 21 | #include "net/base/ssl_config_service.h" |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 22 | #include "net/base/upload_data_stream.h" |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 23 | #include "net/socket/client_socket.h" |
| 24 | #include "net/socket/client_socket_handle.h" |
[email protected] | 7fc5b09a | 2010-02-27 00:07:38 | [diff] [blame] | 25 | #include "net/socket/tcp_client_socket_pool.h" |
[email protected] | dab9c7d | 2010-02-06 21:44:32 | [diff] [blame] | 26 | #include "net/spdy/spdy_framer.h" |
| 27 | #include "net/spdy/spdy_io_buffer.h" |
| 28 | #include "net/spdy/spdy_protocol.h" |
| 29 | #include "net/spdy/spdy_session_pool.h" |
[email protected] | eb6e29ac | 2010-05-04 01:31:13 | [diff] [blame] | 30 | #include "testing/gtest/include/gtest/gtest_prod.h" // For FRIEND_TEST |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 31 | |
| 32 | namespace net { |
| 33 | |
[email protected] | 955fc2e7 | 2010-02-08 20:37:30 | [diff] [blame] | 34 | class SpdyStream; |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 35 | class HttpNetworkSession; |
[email protected] | 9e743cd | 2010-03-16 07:03:53 | [diff] [blame] | 36 | class BoundNetLog; |
[email protected] | dcc6bbb | 2009-12-09 19:09:01 | [diff] [blame] | 37 | class SSLInfo; |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 38 | |
[email protected] | 955fc2e7 | 2010-02-08 20:37:30 | [diff] [blame] | 39 | class SpdySession : public base::RefCounted<SpdySession>, |
| 40 | public spdy::SpdyFramerVisitorInterface { |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 41 | public: |
[email protected] | 807c01a | 2010-04-21 16:57:45 | [diff] [blame] | 42 | // Create a new SpdySession. |
| 43 | // |host_port_pair| is the host/port that this session connects to. |
[email protected] | 635909f | 2010-05-12 18:19:36 | [diff] [blame] | 44 | // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log |
| 45 | // network events to. |
| 46 | SpdySession(const HostPortPair& host_port_pair, HttpNetworkSession* session, |
[email protected] | 4429700 | 2010-05-16 00:59:10 | [diff] [blame] | 47 | NetLog* net_log); |
[email protected] | 807c01a | 2010-04-21 16:57:45 | [diff] [blame] | 48 | |
[email protected] | 367ead4 | 2010-02-26 00:15:21 | [diff] [blame] | 49 | const HostPortPair& host_port_pair() const { return host_port_pair_; } |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 50 | |
[email protected] | 955fc2e7 | 2010-02-08 20:37:30 | [diff] [blame] | 51 | // Connect the Spdy Socket. |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 52 | // Returns net::Error::OK on success. |
| 53 | // Note that this call does not wait for the connect to complete. Callers can |
[email protected] | 955fc2e7 | 2010-02-08 20:37:30 | [diff] [blame] | 54 | // immediately start using the SpdySession while it connects. |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 55 | net::Error Connect(const std::string& group_name, |
[email protected] | 7fc5b09a | 2010-02-27 00:07:38 | [diff] [blame] | 56 | const TCPSocketParams& destination, |
[email protected] | 635909f | 2010-05-12 18:19:36 | [diff] [blame] | 57 | RequestPriority priority); |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 58 | |
[email protected] | 9be804c8 | 2010-06-24 17:59:46 | [diff] [blame] | 59 | // Get a pushed stream for a given |url|. |
| 60 | // If the server initiates a stream, it might already exist for a given path. |
| 61 | // The server might also not have initiated the stream yet, but indicated it |
[email protected] | bdbda46 | 2010-06-28 17:30:37 | [diff] [blame^] | 62 | // will via X-Associated-Content. Writes the stream out to |spdy_stream|. |
| 63 | // Returns a net error code. |
| 64 | int GetPushStream( |
[email protected] | 9be804c8 | 2010-06-24 17:59:46 | [diff] [blame] | 65 | const GURL& url, |
[email protected] | bdbda46 | 2010-06-28 17:30:37 | [diff] [blame^] | 66 | scoped_refptr<SpdyStream>* spdy_stream, |
[email protected] | 9be804c8 | 2010-06-24 17:59:46 | [diff] [blame] | 67 | const BoundNetLog& stream_net_log); |
| 68 | |
[email protected] | bdbda46 | 2010-06-28 17:30:37 | [diff] [blame^] | 69 | // Create a new stream for a given |url|. Writes it out to |spdy_stream|. |
| 70 | // Returns a net error code. |
| 71 | int CreateStream( |
[email protected] | 9be804c8 | 2010-06-24 17:59:46 | [diff] [blame] | 72 | const GURL& url, |
| 73 | RequestPriority priority, |
[email protected] | bdbda46 | 2010-06-28 17:30:37 | [diff] [blame^] | 74 | scoped_refptr<SpdyStream>* spdy_stream, |
[email protected] | 33c477b | 2010-05-13 19:21:07 | [diff] [blame] | 75 | const BoundNetLog& stream_net_log); |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 76 | |
[email protected] | 807c01a | 2010-04-21 16:57:45 | [diff] [blame] | 77 | // Used by SpdySessionPool to initialize with a pre-existing SSL socket. |
[email protected] | 26ef658 | 2010-06-24 02:30:47 | [diff] [blame] | 78 | // Returns OK on success, or an error on failure. |
[email protected] | bdbda46 | 2010-06-28 17:30:37 | [diff] [blame^] | 79 | net::Error InitializeWithSSLSocket(ClientSocketHandle* connection, |
| 80 | int certificate_error_code); |
[email protected] | 807c01a | 2010-04-21 16:57:45 | [diff] [blame] | 81 | |
[email protected] | 9be804c8 | 2010-06-24 17:59:46 | [diff] [blame] | 82 | // Send the SYN frame for |stream_id|. |
| 83 | int WriteSynStream( |
| 84 | spdy::SpdyStreamId stream_id, |
| 85 | RequestPriority priority, |
| 86 | spdy::SpdyControlFlags flags, |
| 87 | const linked_ptr<spdy::SpdyHeaderBlock>& headers); |
| 88 | |
[email protected] | ff57bb8 | 2009-11-12 06:52:14 | [diff] [blame] | 89 | // Write a data frame to the stream. |
| 90 | // Used to create and queue a data frame for the given stream. |
[email protected] | 955fc2e7 | 2010-02-08 20:37:30 | [diff] [blame] | 91 | int WriteStreamData(spdy::SpdyStreamId stream_id, net::IOBuffer* data, |
[email protected] | ff57bb8 | 2009-11-12 06:52:14 | [diff] [blame] | 92 | int len); |
| 93 | |
[email protected] | 48599ca | 2010-06-15 23:10:36 | [diff] [blame] | 94 | // Close a stream. |
| 95 | void CloseStream(spdy::SpdyStreamId stream_id, int status); |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 96 | |
| 97 | // Check if a stream is active. |
[email protected] | 955fc2e7 | 2010-02-08 20:37:30 | [diff] [blame] | 98 | bool IsStreamActive(spdy::SpdyStreamId stream_id) const; |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 99 | |
| 100 | // The LoadState is used for informing the user of the current network |
| 101 | // status, such as "resolving host", "connecting", etc. |
| 102 | LoadState GetLoadState() const; |
[email protected] | d1eda93 | 2009-11-04 01:03:10 | [diff] [blame] | 103 | |
[email protected] | 48599ca | 2010-06-15 23:10:36 | [diff] [blame] | 104 | // Closes all streams. Used as part of shutdown. |
| 105 | void CloseAllStreams(net::Error status); |
[email protected] | 807c01a | 2010-04-21 16:57:45 | [diff] [blame] | 106 | |
[email protected] | 9be804c8 | 2010-06-24 17:59:46 | [diff] [blame] | 107 | // Fills SSL info in |ssl_info| and returns true when SSL is in use. |
| 108 | bool GetSSLInfo(SSLInfo* ssl_info, bool* was_npn_negotiated); |
| 109 | |
[email protected] | 34437af8 | 2009-11-06 02:28:49 | [diff] [blame] | 110 | // Enable or disable SSL. |
| 111 | static void SetSSLMode(bool enable) { use_ssl_ = enable; } |
[email protected] | 85c0ed8 | 2009-12-15 23:14:14 | [diff] [blame] | 112 | static bool SSLMode() { return use_ssl_; } |
[email protected] | 34437af8 | 2009-11-06 02:28:49 | [diff] [blame] | 113 | |
[email protected] | 807c01a | 2010-04-21 16:57:45 | [diff] [blame] | 114 | private: |
| 115 | friend class base::RefCounted<SpdySession>; |
[email protected] | 9be804c8 | 2010-06-24 17:59:46 | [diff] [blame] | 116 | FRIEND_TEST(SpdySessionTest, GetActivePushStream); |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 117 | |
[email protected] | 60253bd | 2009-12-01 01:16:39 | [diff] [blame] | 118 | enum State { |
| 119 | IDLE, |
| 120 | CONNECTING, |
| 121 | CONNECTED, |
| 122 | CLOSED |
| 123 | }; |
| 124 | |
[email protected] | 955fc2e7 | 2010-02-08 20:37:30 | [diff] [blame] | 125 | typedef std::map<int, scoped_refptr<SpdyStream> > ActiveStreamMap; |
[email protected] | 65d56aa | 2010-06-14 04:13:40 | [diff] [blame] | 126 | // Only HTTP push a stream. |
[email protected] | 9be804c8 | 2010-06-24 17:59:46 | [diff] [blame] | 127 | typedef std::list<scoped_refptr<SpdyStream> > ActivePushedStreamList; |
| 128 | typedef std::map<std::string, scoped_refptr<SpdyStream> > PendingStreamMap; |
[email protected] | 955fc2e7 | 2010-02-08 20:37:30 | [diff] [blame] | 129 | typedef std::priority_queue<SpdyIOBuffer> OutputQueue; |
[email protected] | a677f2b | 2009-11-22 00:43:00 | [diff] [blame] | 130 | |
[email protected] | 955fc2e7 | 2010-02-08 20:37:30 | [diff] [blame] | 131 | virtual ~SpdySession(); |
[email protected] | 5389bc7 | 2009-11-05 23:34:24 | [diff] [blame] | 132 | |
[email protected] | 955fc2e7 | 2010-02-08 20:37:30 | [diff] [blame] | 133 | // SpdyFramerVisitorInterface |
| 134 | virtual void OnError(spdy::SpdyFramer*); |
| 135 | virtual void OnStreamFrameData(spdy::SpdyStreamId stream_id, |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 136 | const char* data, |
[email protected] | aeac1e4 | 2009-10-10 00:26:01 | [diff] [blame] | 137 | size_t len); |
[email protected] | 955fc2e7 | 2010-02-08 20:37:30 | [diff] [blame] | 138 | virtual void OnControl(const spdy::SpdyControlFrame* frame); |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 139 | |
| 140 | // Control frame handlers. |
[email protected] | 651b77c | 2010-03-10 19:29:42 | [diff] [blame] | 141 | void OnSyn(const spdy::SpdySynStreamControlFrame& frame, |
[email protected] | 33c477b | 2010-05-13 19:21:07 | [diff] [blame] | 142 | const linked_ptr<spdy::SpdyHeaderBlock>& headers); |
[email protected] | 651b77c | 2010-03-10 19:29:42 | [diff] [blame] | 143 | void OnSynReply(const spdy::SpdySynReplyControlFrame& frame, |
[email protected] | 33c477b | 2010-05-13 19:21:07 | [diff] [blame] | 144 | const linked_ptr<spdy::SpdyHeaderBlock>& headers); |
[email protected] | 651b77c | 2010-03-10 19:29:42 | [diff] [blame] | 145 | void OnFin(const spdy::SpdyRstStreamControlFrame& frame); |
| 146 | void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame); |
[email protected] | 74188f2 | 2010-04-09 20:18:50 | [diff] [blame] | 147 | void OnSettings(const spdy::SpdySettingsControlFrame& frame); |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 148 | |
| 149 | // IO Callbacks |
[email protected] | 18c53ae | 2009-10-01 18:18:52 | [diff] [blame] | 150 | void OnTCPConnect(int result); |
| 151 | void OnSSLConnect(int result); |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 152 | void OnReadComplete(int result); |
| 153 | void OnWriteComplete(int result); |
| 154 | |
[email protected] | 74188f2 | 2010-04-09 20:18:50 | [diff] [blame] | 155 | // Send relevant SETTINGS. This is generally called on connection setup. |
| 156 | void SendSettings(); |
| 157 | |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 158 | // Start reading from the socket. |
[email protected] | 26ef658 | 2010-06-24 02:30:47 | [diff] [blame] | 159 | // Returns OK on success, or an error on failure. |
| 160 | net::Error ReadSocket(); |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 161 | |
| 162 | // Write current data to the socket. |
| 163 | void WriteSocketLater(); |
| 164 | void WriteSocket(); |
| 165 | |
| 166 | // Get a new stream id. |
| 167 | int GetNewStreamId(); |
| 168 | |
[email protected] | 74188f2 | 2010-04-09 20:18:50 | [diff] [blame] | 169 | // Queue a frame for sending. |
| 170 | // |frame| is the frame to send. |
| 171 | // |priority| is the priority for insertion into the queue. |
| 172 | // |stream| is the stream which this IO is associated with (or NULL). |
| 173 | void QueueFrame(spdy::SpdyFrame* frame, spdy::SpdyPriority priority, |
| 174 | SpdyStream* stream); |
| 175 | |
[email protected] | 60253bd | 2009-12-01 01:16:39 | [diff] [blame] | 176 | // Closes this session. This will close all active streams and mark |
| 177 | // the session as permanently closed. |
[email protected] | 353f616 | 2009-12-10 18:04:12 | [diff] [blame] | 178 | // |err| should not be OK; this function is intended to be called on |
| 179 | // error. |
| 180 | void CloseSessionOnError(net::Error err); |
[email protected] | 60253bd | 2009-12-01 01:16:39 | [diff] [blame] | 181 | |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 182 | // Track active streams in the active stream list. |
[email protected] | 955fc2e7 | 2010-02-08 20:37:30 | [diff] [blame] | 183 | void ActivateStream(SpdyStream* stream); |
[email protected] | 48599ca | 2010-06-15 23:10:36 | [diff] [blame] | 184 | void DeleteStream(spdy::SpdyStreamId id, int status); |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 185 | |
[email protected] | 4b4762a | 2010-04-23 16:04:14 | [diff] [blame] | 186 | // Removes this session from the session pool. |
| 187 | void RemoveFromPool(); |
| 188 | |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 189 | // Check if we have a pending pushed-stream for this url |
| 190 | // Returns the stream if found (and returns it from the pending |
| 191 | // list), returns NULL otherwise. |
[email protected] | 9be804c8 | 2010-06-24 17:59:46 | [diff] [blame] | 192 | scoped_refptr<SpdyStream> GetActivePushStream(const std::string& url); |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 193 | |
[email protected] | 9be804c8 | 2010-06-24 17:59:46 | [diff] [blame] | 194 | // Calls OnResponseReceived(). |
[email protected] | 3f662f1 | 2010-03-25 19:56:12 | [diff] [blame] | 195 | // Returns true if successful. |
| 196 | bool Respond(const spdy::SpdyHeaderBlock& headers, |
| 197 | const scoped_refptr<SpdyStream> stream); |
| 198 | |
[email protected] | 0aebc00 | 2010-05-21 06:50:19 | [diff] [blame] | 199 | void RecordHistograms(); |
| 200 | |
[email protected] | 955fc2e7 | 2010-02-08 20:37:30 | [diff] [blame] | 201 | // Callbacks for the Spdy session. |
| 202 | CompletionCallbackImpl<SpdySession> connect_callback_; |
| 203 | CompletionCallbackImpl<SpdySession> ssl_connect_callback_; |
| 204 | CompletionCallbackImpl<SpdySession> read_callback_; |
| 205 | CompletionCallbackImpl<SpdySession> write_callback_; |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 206 | |
| 207 | // The domain this session is connected to. |
[email protected] | 367ead4 | 2010-02-26 00:15:21 | [diff] [blame] | 208 | const HostPortPair host_port_pair_; |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 209 | |
[email protected] | 18c53ae | 2009-10-01 18:18:52 | [diff] [blame] | 210 | SSLConfig ssl_config_; |
| 211 | |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 212 | scoped_refptr<HttpNetworkSession> session_; |
| 213 | |
| 214 | // The socket handle for this session. |
[email protected] | 1f14a91 | 2009-12-21 20:32:44 | [diff] [blame] | 215 | scoped_ptr<ClientSocketHandle> connection_; |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 216 | |
| 217 | // The read buffer used to read data from the socket. |
[email protected] | 230cadd | 2009-09-22 16:33:59 | [diff] [blame] | 218 | scoped_refptr<IOBuffer> read_buffer_; |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 219 | bool read_pending_; |
| 220 | |
| 221 | int stream_hi_water_mark_; // The next stream id to use. |
| 222 | |
[email protected] | 9330067 | 2009-10-24 13:22:51 | [diff] [blame] | 223 | // TODO(mbelshe): We need to track these stream lists better. |
| 224 | // I suspect it is possible to remove a stream from |
| 225 | // one list, but not the other. |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 226 | |
[email protected] | a677f2b | 2009-11-22 00:43:00 | [diff] [blame] | 227 | // Map from stream id to all active streams. Streams are active in the sense |
[email protected] | 955fc2e7 | 2010-02-08 20:37:30 | [diff] [blame] | 228 | // that they have a consumer (typically SpdyNetworkTransaction and regardless |
[email protected] | a677f2b | 2009-11-22 00:43:00 | [diff] [blame] | 229 | // of whether or not there is currently any ongoing IO [might be waiting for |
| 230 | // the server to start pushing the stream]) or there are still network events |
| 231 | // incoming even though the consumer has already gone away (cancellation). |
| 232 | // TODO(willchan): Perhaps we should separate out cancelled streams and move |
| 233 | // them into a separate ActiveStreamMap, and not deliver network events to |
| 234 | // them? |
| 235 | ActiveStreamMap active_streams_; |
| 236 | // List of all the streams that have already started to be pushed by the |
| 237 | // server, but do not have consumers yet. |
[email protected] | 65d56aa | 2010-06-14 04:13:40 | [diff] [blame] | 238 | ActivePushedStreamList pushed_streams_; |
[email protected] | a677f2b | 2009-11-22 00:43:00 | [diff] [blame] | 239 | // List of streams declared in X-Associated-Content headers, but do not have |
| 240 | // consumers yet. |
[email protected] | 18c53ae | 2009-10-01 18:18:52 | [diff] [blame] | 241 | // The key is a string representing the path of the URI being pushed. |
[email protected] | 2931238b | 2009-11-19 01:19:51 | [diff] [blame] | 242 | PendingStreamMap pending_streams_; |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 243 | |
| 244 | // As we gather data to be sent, we put it into the output queue. |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 245 | OutputQueue queue_; |
| 246 | |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 247 | // The packet we are currently sending. |
[email protected] | e124535 | 2009-11-30 19:42:42 | [diff] [blame] | 248 | bool write_pending_; // Will be true when a write is in progress. |
[email protected] | 955fc2e7 | 2010-02-08 20:37:30 | [diff] [blame] | 249 | SpdyIOBuffer in_flight_write_; // This is the write buffer in progress. |
[email protected] | e124535 | 2009-11-30 19:42:42 | [diff] [blame] | 250 | |
| 251 | // Flag if we have a pending message scheduled for WriteSocket. |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 252 | bool delayed_write_pending_; |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 253 | |
[email protected] | 955fc2e7 | 2010-02-08 20:37:30 | [diff] [blame] | 254 | // Flag if we're using an SSL connection for this SpdySession. |
[email protected] | dcc6bbb | 2009-12-09 19:09:01 | [diff] [blame] | 255 | bool is_secure_; |
| 256 | |
[email protected] | bdbda46 | 2010-06-28 17:30:37 | [diff] [blame^] | 257 | // Certificate error code when using a secure connection. |
| 258 | int certificate_error_code_; |
| 259 | |
[email protected] | 955fc2e7 | 2010-02-08 20:37:30 | [diff] [blame] | 260 | // Spdy Frame state. |
| 261 | spdy::SpdyFramer spdy_framer_; |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 262 | |
[email protected] | 60253bd | 2009-12-01 01:16:39 | [diff] [blame] | 263 | // If an error has occurred on the session, the session is effectively |
| 264 | // dead. Record this error here. When no error has occurred, |error_| will |
| 265 | // be OK. |
| 266 | net::Error error_; |
| 267 | State state_; |
| 268 | |
[email protected] | 9b01080 | 2009-12-27 22:55:30 | [diff] [blame] | 269 | // Some statistics counters for the session. |
| 270 | int streams_initiated_count_; |
| 271 | int streams_pushed_count_; |
| 272 | int streams_pushed_and_claimed_count_; |
| 273 | int streams_abandoned_count_; |
[email protected] | 0aebc00 | 2010-05-21 06:50:19 | [diff] [blame] | 274 | bool sent_settings_; // Did this session send settings when it started. |
| 275 | bool received_settings_; // Did this session receive at least one settings |
| 276 | // frame. |
[email protected] | 9b01080 | 2009-12-27 22:55:30 | [diff] [blame] | 277 | |
[email protected] | 4b4762a | 2010-04-23 16:04:14 | [diff] [blame] | 278 | bool in_session_pool_; // True if the session is currently in the pool. |
| 279 | |
[email protected] | 635909f | 2010-05-12 18:19:36 | [diff] [blame] | 280 | BoundNetLog net_log_; |
| 281 | |
[email protected] | affe8fe | 2009-10-14 20:06:05 | [diff] [blame] | 282 | static bool use_ssl_; |
[email protected] | aea8060 | 2009-09-18 00:55:08 | [diff] [blame] | 283 | }; |
| 284 | |
| 285 | } // namespace net |
| 286 | |
[email protected] | dab9c7d | 2010-02-06 21:44:32 | [diff] [blame] | 287 | #endif // NET_SPDY_SPDY_SESSION_H_ |