| 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 |
| 161 void set_in_session_pool(bool val) { in_session_pool_ = val; } | 167 void set_in_session_pool(bool val) { in_session_pool_ = val; } |
| 162 | 168 |
| 163 // Access to the number of active and pending streams. These are primarily | 169 // Access to the number of active and pending streams. These are primarily |
| 164 // available for testing and diagnostics. | 170 // available for testing and diagnostics. |
| 165 size_t num_active_streams() const { return active_streams_.size(); } | 171 size_t num_active_streams() const { return active_streams_.size(); } |
| 166 size_t num_unclaimed_pushed_streams() const { | 172 size_t num_unclaimed_pushed_streams() const { |
| 167 return unclaimed_pushed_streams_.size(); | 173 return unclaimed_pushed_streams_.size(); |
| 168 } | 174 } |
| 169 | 175 |
| 170 const BoundNetLog& net_log() const { return net_log_; } | 176 const BoundNetLog& net_log() const { return net_log_; } |
| 171 | 177 |
| 178 int GetPeerAddress(AddressList* address) const { |
| 179 return connection_->socket()->GetPeerAddress(address); |
| 180 } |
| 181 |
| 172 private: | 182 private: |
| 173 friend class base::RefCounted<SpdySession>; | 183 friend class base::RefCounted<SpdySession>; |
| 174 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GetActivePushStream); | 184 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GetActivePushStream); |
| 175 | 185 |
| 176 enum State { | 186 enum State { |
| 177 IDLE, | 187 IDLE, |
| 178 CONNECTING, | 188 CONNECTING, |
| 179 CONNECTED, | 189 CONNECTED, |
| 180 CLOSED | 190 CLOSED |
| 181 }; | 191 }; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 | 379 |
| 370 BoundNetLog net_log_; | 380 BoundNetLog net_log_; |
| 371 | 381 |
| 372 static bool use_ssl_; | 382 static bool use_ssl_; |
| 373 static bool use_flow_control_; | 383 static bool use_flow_control_; |
| 374 }; | 384 }; |
| 375 | 385 |
| 376 } // namespace net | 386 } // namespace net |
| 377 | 387 |
| 378 #endif // NET_SPDY_SPDY_SESSION_H_ | 388 #endif // NET_SPDY_SPDY_SESSION_H_ |
| OLD | NEW |