| 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 // A client specific QuicSession subclass. This class owns the underlying | 5 // A client specific QuicSession subclass. This class owns the underlying |
| 6 // QuicConnection and QuicConnectionHelper objects. The connection stores | 6 // QuicConnection and QuicConnectionHelper objects. The connection stores |
| 7 // a non-owning pointer to the helper so this session needs to ensure that | 7 // a non-owning pointer to the helper so this session needs to ensure that |
| 8 // the helper outlives the connection. | 8 // the helper outlives the connection. |
| 9 | 9 |
| 10 #ifndef NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ | 10 #ifndef NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // Gets the SSL connection information. | 177 // Gets the SSL connection information. |
| 178 bool GetSSLInfo(SSLInfo* ssl_info) const; | 178 bool GetSSLInfo(SSLInfo* ssl_info) const; |
| 179 | 179 |
| 180 // Performs a crypto handshake with the server. | 180 // Performs a crypto handshake with the server. |
| 181 int CryptoConnect(bool require_confirmation, | 181 int CryptoConnect(bool require_confirmation, |
| 182 const CompletionCallback& callback); | 182 const CompletionCallback& callback); |
| 183 | 183 |
| 184 // Resumes a crypto handshake with the server after a timeout. | 184 // Resumes a crypto handshake with the server after a timeout. |
| 185 int ResumeCryptoConnect(const CompletionCallback& callback); | 185 int ResumeCryptoConnect(const CompletionCallback& callback); |
| 186 | 186 |
| 187 // Causes the QuicConnectionHelper to start reading from the socket | 187 // Causes the QuicConnectionHelper to start reading from all sockets |
| 188 // and passing the data along to the QuicConnection. | 188 // and passing the data along to the QuicConnection. |
| 189 void StartReading(); | 189 void StartReading(); |
| 190 | 190 |
| 191 // Close the session because of |error| and notifies the factory | 191 // Close the session because of |error| and notifies the factory |
| 192 // that this session has been closed, which will delete the session. | 192 // that this session has been closed, which will delete the session. |
| 193 void CloseSessionOnError(int error, QuicErrorCode quic_error); | 193 void CloseSessionOnError(int error, QuicErrorCode quic_error); |
| 194 | 194 |
| 195 // Close the session because of |error| and notifies the factory later that | 195 // Close the session because of |error| and notifies the factory later that |
| 196 // this session has been closed, which will delete the session. | 196 // this session has been closed, which will delete the session. |
| 197 void CloseSessionOnErrorAndNotifyFactoryLater(int error, | 197 void CloseSessionOnErrorAndNotifyFactoryLater(int error, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 210 | 210 |
| 211 // Returns true if |hostname| may be pooled onto this session. If this | 211 // Returns true if |hostname| may be pooled onto this session. If this |
| 212 // is a secure QUIC session, then |hostname| must match the certificate | 212 // is a secure QUIC session, then |hostname| must match the certificate |
| 213 // presented during the handshake. | 213 // presented during the handshake. |
| 214 bool CanPool(const std::string& hostname, PrivacyMode privacy_mode) const; | 214 bool CanPool(const std::string& hostname, PrivacyMode privacy_mode) const; |
| 215 | 215 |
| 216 const QuicServerId& server_id() const { return server_id_; } | 216 const QuicServerId& server_id() const { return server_id_; } |
| 217 | 217 |
| 218 QuicDisabledReason disabled_reason() const { return disabled_reason_; } | 218 QuicDisabledReason disabled_reason() const { return disabled_reason_; } |
| 219 | 219 |
| 220 // Call to add a new socket to the session. Takes ownership of |socket|. |
| 221 void AddSocket(scoped_ptr<DatagramClientSocket> socket); |
| 222 |
| 223 // Call to add a new PacketReader to the session. Returns true if reader was |
| 224 // successfully added to the session. Takes ownership of |reader|. |
| 225 bool AddPacketReader(QuicPacketReader* reader); |
| 226 |
| 220 protected: | 227 protected: |
| 221 // QuicSession methods: | 228 // QuicSession methods: |
| 222 QuicDataStream* CreateIncomingDynamicStream(QuicStreamId id) override; | 229 QuicDataStream* CreateIncomingDynamicStream(QuicStreamId id) override; |
| 223 | 230 |
| 224 private: | 231 private: |
| 225 friend class test::QuicChromiumClientSessionPeer; | 232 friend class test::QuicChromiumClientSessionPeer; |
| 226 | 233 |
| 227 typedef std::set<Observer*> ObserverSet; | 234 typedef std::set<Observer*> ObserverSet; |
| 228 typedef std::list<StreamRequest*> StreamRequestQueue; | 235 typedef std::list<StreamRequest*> StreamRequestQueue; |
| 229 | 236 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 259 // Notifies the factory that this session has been closed which will | 266 // Notifies the factory that this session has been closed which will |
| 260 // delete |this|. | 267 // delete |this|. |
| 261 void NotifyFactoryOfSessionClosed(); | 268 void NotifyFactoryOfSessionClosed(); |
| 262 | 269 |
| 263 void OnConnectTimeout(); | 270 void OnConnectTimeout(); |
| 264 | 271 |
| 265 QuicServerId server_id_; | 272 QuicServerId server_id_; |
| 266 bool require_confirmation_; | 273 bool require_confirmation_; |
| 267 scoped_ptr<QuicCryptoClientStream> crypto_stream_; | 274 scoped_ptr<QuicCryptoClientStream> crypto_stream_; |
| 268 QuicStreamFactory* stream_factory_; | 275 QuicStreamFactory* stream_factory_; |
| 269 scoped_ptr<DatagramClientSocket> socket_; | 276 std::vector<scoped_ptr<DatagramClientSocket>> sockets_; |
| 270 TransportSecurityState* transport_security_state_; | 277 TransportSecurityState* transport_security_state_; |
| 271 scoped_ptr<QuicServerInfo> server_info_; | 278 scoped_ptr<QuicServerInfo> server_info_; |
| 272 scoped_ptr<CertVerifyResult> cert_verify_result_; | 279 scoped_ptr<CertVerifyResult> cert_verify_result_; |
| 273 std::string pinning_failure_log_; | 280 std::string pinning_failure_log_; |
| 274 ObserverSet observers_; | 281 ObserverSet observers_; |
| 275 StreamRequestQueue stream_requests_; | 282 StreamRequestQueue stream_requests_; |
| 276 CompletionCallback callback_; | 283 CompletionCallback callback_; |
| 277 size_t num_total_streams_; | 284 size_t num_total_streams_; |
| 278 base::TaskRunner* task_runner_; | 285 base::TaskRunner* task_runner_; |
| 279 BoundNetLog net_log_; | 286 BoundNetLog net_log_; |
| 280 QuicPacketReader packet_reader_; | 287 std::vector<scoped_ptr<QuicPacketReader>> packet_readers_; |
| 281 base::TimeTicks dns_resolution_end_time_; | 288 base::TimeTicks dns_resolution_end_time_; |
| 282 base::TimeTicks handshake_start_; // Time the handshake was started. | 289 base::TimeTicks handshake_start_; // Time the handshake was started. |
| 283 scoped_ptr<QuicConnectionLogger> logger_; | 290 scoped_ptr<QuicConnectionLogger> logger_; |
| 284 // True when the session is going away, and streams may no longer be created | 291 // True when the session is going away, and streams may no longer be created |
| 285 // on this session. Existing stream will continue to be processed. | 292 // on this session. Existing stream will continue to be processed. |
| 286 bool going_away_; | 293 bool going_away_; |
| 287 QuicDisabledReason disabled_reason_; | 294 QuicDisabledReason disabled_reason_; |
| 288 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; | 295 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; |
| 289 | 296 |
| 290 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); | 297 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); |
| 291 }; | 298 }; |
| 292 | 299 |
| 293 } // namespace net | 300 } // namespace net |
| 294 | 301 |
| 295 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ | 302 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
| OLD | NEW |