OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 spdy::SpdyStreamId stream_id, | 84 spdy::SpdyStreamId stream_id, |
85 RequestPriority priority, | 85 RequestPriority priority, |
86 spdy::SpdyControlFlags flags, | 86 spdy::SpdyControlFlags flags, |
87 const linked_ptr<spdy::SpdyHeaderBlock>& headers); | 87 const linked_ptr<spdy::SpdyHeaderBlock>& headers); |
88 | 88 |
89 // Write a data frame to the stream. | 89 // Write a data frame to the stream. |
90 // Used to create and queue a data frame for the given stream. | 90 // Used to create and queue a data frame for the given stream. |
91 int WriteStreamData(spdy::SpdyStreamId stream_id, net::IOBuffer* data, | 91 int WriteStreamData(spdy::SpdyStreamId stream_id, net::IOBuffer* data, |
92 int len); | 92 int len); |
93 | 93 |
94 // This marks the stream as half closed from the client side, and removes it | 94 // Close a stream. |
95 // from the active_streams_ map. | 95 void CloseStream(spdy::SpdyStreamId stream_id, int status); |
96 void CloseStream(spdy::SpdyStreamId id, int status); | |
97 // This is identical to CloseStream, except it also sends a Rst stream frame. | |
98 void CloseStreamAndSendRst(spdy::SpdyStreamId stream_id, int status); | |
99 | |
100 // Half close a stream. | |
101 void HalfCloseStreamClientSide(spdy::SpdyStreamId stream_id, int status); | |
102 void HalfCloseStreamServerSide(spdy::SpdyStreamId stream_id, int status); | |
103 | |
104 | 96 |
105 // Check if a stream is active. | 97 // Check if a stream is active. |
106 bool IsStreamActive(spdy::SpdyStreamId stream_id) const; | 98 bool IsStreamActive(spdy::SpdyStreamId stream_id) const; |
107 | 99 |
108 // The LoadState is used for informing the user of the current network | 100 // The LoadState is used for informing the user of the current network |
109 // status, such as "resolving host", "connecting", etc. | 101 // status, such as "resolving host", "connecting", etc. |
110 LoadState GetLoadState() const; | 102 LoadState GetLoadState() const; |
111 | 103 |
112 // Closes all streams. Used as part of shutdown. | 104 // Closes all streams. Used as part of shutdown. |
113 void CloseAllStreams(net::Error status); | 105 void CloseAllStreams(net::Error status); |
(...skipping 29 matching lines...) Expand all Loading... |
143 virtual void OnStreamFrameData(spdy::SpdyStreamId stream_id, | 135 virtual void OnStreamFrameData(spdy::SpdyStreamId stream_id, |
144 const char* data, | 136 const char* data, |
145 size_t len); | 137 size_t len); |
146 virtual void OnControl(const spdy::SpdyControlFrame* frame); | 138 virtual void OnControl(const spdy::SpdyControlFrame* frame); |
147 | 139 |
148 // Control frame handlers. | 140 // Control frame handlers. |
149 void OnSyn(const spdy::SpdySynStreamControlFrame& frame, | 141 void OnSyn(const spdy::SpdySynStreamControlFrame& frame, |
150 const linked_ptr<spdy::SpdyHeaderBlock>& headers); | 142 const linked_ptr<spdy::SpdyHeaderBlock>& headers); |
151 void OnSynReply(const spdy::SpdySynReplyControlFrame& frame, | 143 void OnSynReply(const spdy::SpdySynReplyControlFrame& frame, |
152 const linked_ptr<spdy::SpdyHeaderBlock>& headers); | 144 const linked_ptr<spdy::SpdyHeaderBlock>& headers); |
153 void OnRst(const spdy::SpdyRstStreamControlFrame& frame); | 145 void OnFin(const spdy::SpdyRstStreamControlFrame& frame); |
154 void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame); | 146 void OnGoAway(const spdy::SpdyGoAwayControlFrame& frame); |
155 void OnSettings(const spdy::SpdySettingsControlFrame& frame); | 147 void OnSettings(const spdy::SpdySettingsControlFrame& frame); |
156 | 148 |
157 // IO Callbacks | 149 // IO Callbacks |
158 void OnTCPConnect(int result); | 150 void OnTCPConnect(int result); |
159 void OnSSLConnect(int result); | 151 void OnSSLConnect(int result); |
160 void OnReadComplete(int result); | 152 void OnReadComplete(int result); |
161 void OnWriteComplete(int result); | 153 void OnWriteComplete(int result); |
162 | 154 |
163 // Send relevant SETTINGS. This is generally called on connection setup. | 155 // Send relevant SETTINGS. This is generally called on connection setup. |
(...skipping 18 matching lines...) Expand all Loading... |
182 SpdyStream* stream); | 174 SpdyStream* stream); |
183 | 175 |
184 // Closes this session. This will close all active streams and mark | 176 // Closes this session. This will close all active streams and mark |
185 // the session as permanently closed. | 177 // the session as permanently closed. |
186 // |err| should not be OK; this function is intended to be called on | 178 // |err| should not be OK; this function is intended to be called on |
187 // error. | 179 // error. |
188 void CloseSessionOnError(net::Error err); | 180 void CloseSessionOnError(net::Error err); |
189 | 181 |
190 // Track active streams in the active stream list. | 182 // Track active streams in the active stream list. |
191 void ActivateStream(SpdyStream* stream); | 183 void ActivateStream(SpdyStream* stream); |
| 184 void DeleteStream(spdy::SpdyStreamId id, int status); |
192 | 185 |
193 // Removes this session from the session pool. | 186 // Removes this session from the session pool. |
194 void RemoveFromPool(); | 187 void RemoveFromPool(); |
195 | 188 |
196 // Check if we have a pending pushed-stream for this url | 189 // Check if we have a pending pushed-stream for this url |
197 // Returns the stream if found (and returns it from the pending | 190 // Returns the stream if found (and returns it from the pending |
198 // list), returns NULL otherwise. | 191 // list), returns NULL otherwise. |
199 scoped_refptr<SpdyStream> GetActivePushStream(const std::string& url); | 192 scoped_refptr<SpdyStream> GetActivePushStream(const std::string& url); |
200 | 193 |
201 // Calls OnResponseReceived(). | 194 // Calls OnResponseReceived(). |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 // If an error has occurred on the session, the session is effectively | 263 // If an error has occurred on the session, the session is effectively |
271 // dead. Record this error here. When no error has occurred, |error_| will | 264 // dead. Record this error here. When no error has occurred, |error_| will |
272 // be OK. | 265 // be OK. |
273 net::Error error_; | 266 net::Error error_; |
274 State state_; | 267 State state_; |
275 | 268 |
276 // Some statistics counters for the session. | 269 // Some statistics counters for the session. |
277 int streams_initiated_count_; | 270 int streams_initiated_count_; |
278 int streams_pushed_count_; | 271 int streams_pushed_count_; |
279 int streams_pushed_and_claimed_count_; | 272 int streams_pushed_and_claimed_count_; |
280 int streams_abandoned_count_; // # of streams that were pushed & abandoned. | 273 int streams_abandoned_count_; |
281 bool sent_settings_; // Did this session send settings when it started. | 274 bool sent_settings_; // Did this session send settings when it started. |
282 bool received_settings_; // Did this session receive at least one settings | 275 bool received_settings_; // Did this session receive at least one settings |
283 // frame. | 276 // frame. |
284 | 277 |
285 bool in_session_pool_; // True if the session is currently in the pool. | 278 bool in_session_pool_; // True if the session is currently in the pool. |
286 | 279 |
287 BoundNetLog net_log_; | 280 BoundNetLog net_log_; |
288 | 281 |
289 static bool use_ssl_; | 282 static bool use_ssl_; |
290 }; | 283 }; |
291 | 284 |
292 } // namespace net | 285 } // namespace net |
293 | 286 |
294 #endif // NET_SPDY_SPDY_SESSION_H_ | 287 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |