| 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_CLIENT_SESSION_H_ | 10 #ifndef NET_QUIC_QUIC_CLIENT_SESSION_H_ |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 QuicClientSession(QuicConnection* connection, | 92 QuicClientSession(QuicConnection* connection, |
| 93 scoped_ptr<DatagramClientSocket> socket, | 93 scoped_ptr<DatagramClientSocket> socket, |
| 94 scoped_ptr<QuicDefaultPacketWriter> writer, | 94 scoped_ptr<QuicDefaultPacketWriter> writer, |
| 95 QuicStreamFactory* stream_factory, | 95 QuicStreamFactory* stream_factory, |
| 96 QuicCryptoClientStreamFactory* crypto_client_stream_factory, | 96 QuicCryptoClientStreamFactory* crypto_client_stream_factory, |
| 97 scoped_ptr<QuicServerInfo> server_info, | 97 scoped_ptr<QuicServerInfo> server_info, |
| 98 const QuicServerId& server_id, | 98 const QuicServerId& server_id, |
| 99 const QuicConfig& config, | 99 const QuicConfig& config, |
| 100 uint32 max_flow_control_receive_window_bytes, | 100 uint32 max_flow_control_receive_window_bytes, |
| 101 QuicCryptoClientConfig* crypto_config, | 101 QuicCryptoClientConfig* crypto_config, |
| 102 base::TaskRunner* task_runner, |
| 102 NetLog* net_log); | 103 NetLog* net_log); |
| 103 | 104 |
| 104 virtual ~QuicClientSession(); | 105 virtual ~QuicClientSession(); |
| 105 | 106 |
| 106 void AddObserver(Observer* observer); | 107 void AddObserver(Observer* observer); |
| 107 void RemoveObserver(Observer* observer); | 108 void RemoveObserver(Observer* observer); |
| 108 | 109 |
| 109 // Attempts to create a new stream. If the stream can be | 110 // Attempts to create a new stream. If the stream can be |
| 110 // created immediately, returns OK. If the open stream limit | 111 // created immediately, returns OK. If the open stream limit |
| 111 // has been reached, returns ERR_IO_PENDING, and |request| | 112 // has been reached, returns ERR_IO_PENDING, and |request| |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 144 |
| 144 // QuicConnectionVisitorInterface methods: | 145 // QuicConnectionVisitorInterface methods: |
| 145 virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) OVERRIDE; | 146 virtual void OnConnectionClosed(QuicErrorCode error, bool from_peer) OVERRIDE; |
| 146 virtual void OnSuccessfulVersionNegotiation( | 147 virtual void OnSuccessfulVersionNegotiation( |
| 147 const QuicVersion& version) OVERRIDE; | 148 const QuicVersion& version) OVERRIDE; |
| 148 | 149 |
| 149 // Performs a crypto handshake with the server. | 150 // Performs a crypto handshake with the server. |
| 150 int CryptoConnect(bool require_confirmation, | 151 int CryptoConnect(bool require_confirmation, |
| 151 const CompletionCallback& callback); | 152 const CompletionCallback& callback); |
| 152 | 153 |
| 154 // Resumes a crypto handshake with the server after a timeout. |
| 155 int ResumeCryptoConnect(const CompletionCallback& callback); |
| 156 |
| 153 // Causes the QuicConnectionHelper to start reading from the socket | 157 // Causes the QuicConnectionHelper to start reading from the socket |
| 154 // and passing the data along to the QuicConnection. | 158 // and passing the data along to the QuicConnection. |
| 155 void StartReading(); | 159 void StartReading(); |
| 156 | 160 |
| 157 // Close the session because of |error| and notifies the factory | 161 // Close the session because of |error| and notifies the factory |
| 158 // that this session has been closed, which will delete the session. | 162 // that this session has been closed, which will delete the session. |
| 159 void CloseSessionOnError(int error); | 163 void CloseSessionOnError(int error); |
| 160 | 164 |
| 161 base::Value* GetInfoAsValue(const std::set<HostPortPair>& aliases); | 165 base::Value* GetInfoAsValue(const std::set<HostPortPair>& aliases); |
| 162 | 166 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // streams, because closing a stream may cause a new stream to be created. | 211 // streams, because closing a stream may cause a new stream to be created. |
| 208 void NotifyFactoryOfSessionGoingAway(); | 212 void NotifyFactoryOfSessionGoingAway(); |
| 209 | 213 |
| 210 // Posts a task to notify the factory that this session has been closed. | 214 // Posts a task to notify the factory that this session has been closed. |
| 211 void NotifyFactoryOfSessionClosedLater(); | 215 void NotifyFactoryOfSessionClosedLater(); |
| 212 | 216 |
| 213 // Notifies the factory that this session has been closed which will | 217 // Notifies the factory that this session has been closed which will |
| 214 // delete |this|. | 218 // delete |this|. |
| 215 void NotifyFactoryOfSessionClosed(); | 219 void NotifyFactoryOfSessionClosed(); |
| 216 | 220 |
| 221 void OnConnectTimeout(); |
| 222 |
| 217 bool require_confirmation_; | 223 bool require_confirmation_; |
| 218 scoped_ptr<QuicCryptoClientStream> crypto_stream_; | 224 scoped_ptr<QuicCryptoClientStream> crypto_stream_; |
| 219 QuicStreamFactory* stream_factory_; | 225 QuicStreamFactory* stream_factory_; |
| 220 scoped_ptr<DatagramClientSocket> socket_; | 226 scoped_ptr<DatagramClientSocket> socket_; |
| 221 scoped_ptr<QuicDefaultPacketWriter> writer_; | 227 scoped_ptr<QuicDefaultPacketWriter> writer_; |
| 222 scoped_refptr<IOBufferWithSize> read_buffer_; | 228 scoped_refptr<IOBufferWithSize> read_buffer_; |
| 223 scoped_ptr<QuicServerInfo> server_info_; | 229 scoped_ptr<QuicServerInfo> server_info_; |
| 224 scoped_ptr<CertVerifyResult> cert_verify_result_; | 230 scoped_ptr<CertVerifyResult> cert_verify_result_; |
| 225 ObserverSet observers_; | 231 ObserverSet observers_; |
| 226 StreamRequestQueue stream_requests_; | 232 StreamRequestQueue stream_requests_; |
| 227 bool read_pending_; | 233 bool read_pending_; |
| 228 CompletionCallback callback_; | 234 CompletionCallback callback_; |
| 229 size_t num_total_streams_; | 235 size_t num_total_streams_; |
| 236 base::TaskRunner* task_runner_; |
| 230 BoundNetLog net_log_; | 237 BoundNetLog net_log_; |
| 231 QuicConnectionLogger logger_; | 238 QuicConnectionLogger logger_; |
| 232 // Number of packets read in the current read loop. | 239 // Number of packets read in the current read loop. |
| 233 size_t num_packets_read_; | 240 size_t num_packets_read_; |
| 234 // True when the session is going away, and streams may no longer be created | 241 // True when the session is going away, and streams may no longer be created |
| 235 // on this session. Existing stream will continue to be processed. | 242 // on this session. Existing stream will continue to be processed. |
| 236 bool going_away_; | 243 bool going_away_; |
| 237 base::WeakPtrFactory<QuicClientSession> weak_factory_; | 244 base::WeakPtrFactory<QuicClientSession> weak_factory_; |
| 238 | 245 |
| 239 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); | 246 DISALLOW_COPY_AND_ASSIGN(QuicClientSession); |
| 240 }; | 247 }; |
| 241 | 248 |
| 242 } // namespace net | 249 } // namespace net |
| 243 | 250 |
| 244 #endif // NET_QUIC_QUIC_CLIENT_SESSION_H_ | 251 #endif // NET_QUIC_QUIC_CLIENT_SESSION_H_ |
| OLD | NEW |