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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
181 // Gets the SSL connection information. | 181 // Gets the SSL connection information. |
182 bool GetSSLInfo(SSLInfo* ssl_info) const; | 182 bool GetSSLInfo(SSLInfo* ssl_info) const; |
183 | 183 |
184 // Performs a crypto handshake with the server. | 184 // Performs a crypto handshake with the server. |
185 int CryptoConnect(bool require_confirmation, | 185 int CryptoConnect(bool require_confirmation, |
186 const CompletionCallback& callback); | 186 const CompletionCallback& callback); |
187 | 187 |
188 // Resumes a crypto handshake with the server after a timeout. | 188 // Resumes a crypto handshake with the server after a timeout. |
189 int ResumeCryptoConnect(const CompletionCallback& callback); | 189 int ResumeCryptoConnect(const CompletionCallback& callback); |
190 | 190 |
191 // Causes the QuicConnectionHelper to start reading from the socket | 191 // Causes the QuicConnectionHelper to start reading from all sockets |
192 // and passing the data along to the QuicConnection. | 192 // and passing the data along to the QuicConnection. |
193 void StartReading(); | 193 void StartReading(); |
194 | 194 |
195 // Close the session because of |error| and notifies the factory | 195 // Close the session because of |error| and notifies the factory |
196 // that this session has been closed, which will delete the session. | 196 // that this session has been closed, which will delete the session. |
197 void CloseSessionOnError(int error, QuicErrorCode quic_error); | 197 void CloseSessionOnError(int error, QuicErrorCode quic_error); |
198 | 198 |
199 // Close the session because of |error| and notifies the factory later that | 199 // Close the session because of |error| and notifies the factory later that |
200 // this session has been closed, which will delete the session. | 200 // this session has been closed, which will delete the session. |
201 void CloseSessionOnErrorAndNotifyFactoryLater(int error, | 201 void CloseSessionOnErrorAndNotifyFactoryLater(int error, |
(...skipping 12 matching lines...) Expand all Loading... | |
214 | 214 |
215 // Returns true if |hostname| may be pooled onto this session. If this | 215 // Returns true if |hostname| may be pooled onto this session. If this |
216 // is a secure QUIC session, then |hostname| must match the certificate | 216 // is a secure QUIC session, then |hostname| must match the certificate |
217 // presented during the handshake. | 217 // presented during the handshake. |
218 bool CanPool(const std::string& hostname, PrivacyMode privacy_mode) const; | 218 bool CanPool(const std::string& hostname, PrivacyMode privacy_mode) const; |
219 | 219 |
220 const QuicServerId& server_id() const { return server_id_; } | 220 const QuicServerId& server_id() const { return server_id_; } |
221 | 221 |
222 QuicDisabledReason disabled_reason() const { return disabled_reason_; } | 222 QuicDisabledReason disabled_reason() const { return disabled_reason_; } |
223 | 223 |
224 // Migrates session onto new socket, i.e., starts reading from |socket| | |
225 // in addition to any previous sockets, and sets |writer| to be the new | |
226 // default writer. Returns true if socket was successfully added to the | |
227 // session and the session was successfully migrated to using the new socket. | |
228 // Takes ownership of |socket|, |reader|, and |writer|. | |
Ryan Hamilton
2015/11/17 04:57:27
Can you explain why this method would return false
Jana
2015/11/18 04:31:41
Done.
| |
229 bool MigrateToSocket(scoped_ptr<DatagramClientSocket> socket, | |
230 QuicPacketReader* reader, | |
Ryan Hamilton
2015/11/17 04:57:28
Since |reader| and writer are not scoped_ptrs, are
Jana
2015/11/18 04:31:41
Good suggestion. Done.
| |
231 QuicPacketWriter* writer); | |
232 | |
224 protected: | 233 protected: |
225 // QuicSession methods: | 234 // QuicSession methods: |
226 QuicSpdyStream* CreateIncomingDynamicStream(QuicStreamId id) override; | 235 QuicSpdyStream* CreateIncomingDynamicStream(QuicStreamId id) override; |
227 | 236 |
228 private: | 237 private: |
229 friend class test::QuicChromiumClientSessionPeer; | 238 friend class test::QuicChromiumClientSessionPeer; |
230 | 239 |
231 typedef std::set<Observer*> ObserverSet; | 240 typedef std::set<Observer*> ObserverSet; |
232 typedef std::list<StreamRequest*> StreamRequestQueue; | 241 typedef std::list<StreamRequest*> StreamRequestQueue; |
233 | 242 |
(...skipping 29 matching lines...) Expand all Loading... | |
263 // Notifies the factory that this session has been closed which will | 272 // Notifies the factory that this session has been closed which will |
264 // delete |this|. | 273 // delete |this|. |
265 void NotifyFactoryOfSessionClosed(); | 274 void NotifyFactoryOfSessionClosed(); |
266 | 275 |
267 void OnConnectTimeout(); | 276 void OnConnectTimeout(); |
268 | 277 |
269 QuicServerId server_id_; | 278 QuicServerId server_id_; |
270 bool require_confirmation_; | 279 bool require_confirmation_; |
271 scoped_ptr<QuicCryptoClientStream> crypto_stream_; | 280 scoped_ptr<QuicCryptoClientStream> crypto_stream_; |
272 QuicStreamFactory* stream_factory_; | 281 QuicStreamFactory* stream_factory_; |
273 scoped_ptr<DatagramClientSocket> socket_; | 282 std::vector<scoped_ptr<DatagramClientSocket>> sockets_; |
274 TransportSecurityState* transport_security_state_; | 283 TransportSecurityState* transport_security_state_; |
275 scoped_ptr<QuicServerInfo> server_info_; | 284 scoped_ptr<QuicServerInfo> server_info_; |
276 scoped_ptr<CertVerifyResult> cert_verify_result_; | 285 scoped_ptr<CertVerifyResult> cert_verify_result_; |
277 std::string pinning_failure_log_; | 286 std::string pinning_failure_log_; |
278 ObserverSet observers_; | 287 ObserverSet observers_; |
279 StreamRequestQueue stream_requests_; | 288 StreamRequestQueue stream_requests_; |
280 CompletionCallback callback_; | 289 CompletionCallback callback_; |
281 size_t num_total_streams_; | 290 size_t num_total_streams_; |
282 base::TaskRunner* task_runner_; | 291 base::TaskRunner* task_runner_; |
283 BoundNetLog net_log_; | 292 BoundNetLog net_log_; |
284 QuicPacketReader packet_reader_; | 293 std::vector<scoped_ptr<QuicPacketReader>> packet_readers_; |
285 base::TimeTicks dns_resolution_end_time_; | 294 base::TimeTicks dns_resolution_end_time_; |
286 base::TimeTicks handshake_start_; // Time the handshake was started. | 295 base::TimeTicks handshake_start_; // Time the handshake was started. |
287 scoped_ptr<QuicConnectionLogger> logger_; | 296 scoped_ptr<QuicConnectionLogger> logger_; |
288 // True when the session is going away, and streams may no longer be created | 297 // True when the session is going away, and streams may no longer be created |
289 // on this session. Existing stream will continue to be processed. | 298 // on this session. Existing stream will continue to be processed. |
290 bool going_away_; | 299 bool going_away_; |
291 QuicDisabledReason disabled_reason_; | 300 QuicDisabledReason disabled_reason_; |
292 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; | 301 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; |
293 | 302 |
294 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); | 303 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); |
295 }; | 304 }; |
296 | 305 |
297 } // namespace net | 306 } // namespace net |
298 | 307 |
299 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ | 308 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ |
OLD | NEW |