OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // |remove_from_pool| indicates whether to also remove the session from the | 151 // |remove_from_pool| indicates whether to also remove the session from the |
152 // session pool. | 152 // session pool. |
153 void CloseSessionOnError(net::Error err, bool remove_from_pool); | 153 void CloseSessionOnError(net::Error err, bool remove_from_pool); |
154 | 154 |
155 // Indicates whether the session is being reused after having successfully | 155 // Indicates whether the session is being reused after having successfully |
156 // used to send/receive data in the past. | 156 // used to send/receive data in the past. |
157 bool IsReused() const { | 157 bool IsReused() const { |
158 return frames_received_ > 0; | 158 return frames_received_ > 0; |
159 } | 159 } |
160 | 160 |
161 // Returns true if the underlying transport socket ever had any reads or | |
162 // writes. | |
163 bool WasEverUsed() const { | |
164 return connection_->socket()->WasEverUsed(); | |
165 } | |
166 | |
167 void set_in_session_pool(bool val) { in_session_pool_ = val; } | 161 void set_in_session_pool(bool val) { in_session_pool_ = val; } |
168 | 162 |
169 // Access to the number of active and pending streams. These are primarily | 163 // Access to the number of active and pending streams. These are primarily |
170 // available for testing and diagnostics. | 164 // available for testing and diagnostics. |
171 size_t num_active_streams() const { return active_streams_.size(); } | 165 size_t num_active_streams() const { return active_streams_.size(); } |
172 size_t num_unclaimed_pushed_streams() const { | 166 size_t num_unclaimed_pushed_streams() const { |
173 return unclaimed_pushed_streams_.size(); | 167 return unclaimed_pushed_streams_.size(); |
174 } | 168 } |
175 | 169 |
176 const BoundNetLog& net_log() const { return net_log_; } | 170 const BoundNetLog& net_log() const { return net_log_; } |
177 | 171 |
178 int GetPeerAddress(AddressList* address) const { | |
179 return connection_->socket()->GetPeerAddress(address); | |
180 } | |
181 | |
182 private: | 172 private: |
183 friend class base::RefCounted<SpdySession>; | 173 friend class base::RefCounted<SpdySession>; |
184 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GetActivePushStream); | 174 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GetActivePushStream); |
185 | 175 |
186 enum State { | 176 enum State { |
187 IDLE, | 177 IDLE, |
188 CONNECTING, | 178 CONNECTING, |
189 CONNECTED, | 179 CONNECTED, |
190 CLOSED | 180 CLOSED |
191 }; | 181 }; |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 | 369 |
380 BoundNetLog net_log_; | 370 BoundNetLog net_log_; |
381 | 371 |
382 static bool use_ssl_; | 372 static bool use_ssl_; |
383 static bool use_flow_control_; | 373 static bool use_flow_control_; |
384 }; | 374 }; |
385 | 375 |
386 } // namespace net | 376 } // namespace net |
387 | 377 |
388 #endif // NET_SPDY_SPDY_SESSION_H_ | 378 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |