Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(177)

Side by Side Diff: net/quic/quic_chromium_client_session.h

Issue 1327923002: Migrates QUIC sessions to a new network when old network is (about to be) disconnected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@home
Patch Set: Added read/write socket error tests. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // Gets the SSL connection information. 185 // Gets the SSL connection information.
186 bool GetSSLInfo(SSLInfo* ssl_info) const; 186 bool GetSSLInfo(SSLInfo* ssl_info) const;
187 187
188 // Performs a crypto handshake with the server. 188 // Performs a crypto handshake with the server.
189 int CryptoConnect(bool require_confirmation, 189 int CryptoConnect(bool require_confirmation,
190 const CompletionCallback& callback); 190 const CompletionCallback& callback);
191 191
192 // Resumes a crypto handshake with the server after a timeout. 192 // Resumes a crypto handshake with the server after a timeout.
193 int ResumeCryptoConnect(const CompletionCallback& callback); 193 int ResumeCryptoConnect(const CompletionCallback& callback);
194 194
195 // Causes the QuicConnectionHelper to start reading from the socket 195 // Causes the QuicConnectionHelper to start reading from all sockets
196 // and passing the data along to the QuicConnection. 196 // and passing the data along to the QuicConnection.
197 void StartReading(); 197 void StartReading();
198 198
199 // Close the session because of |error| and notifies the factory 199 // Close the session because of |error| and notifies the factory
200 // that this session has been closed, which will delete the session. 200 // that this session has been closed, which will delete the session.
201 void CloseSessionOnError(int error, QuicErrorCode quic_error); 201 void CloseSessionOnError(int error, QuicErrorCode quic_error);
202 202
203 // Close the session because of |error| and notifies the factory later that 203 // Close the session because of |error| and notifies the factory later that
204 // this session has been closed, which will delete the session. 204 // this session has been closed, which will delete the session.
205 void CloseSessionOnErrorAndNotifyFactoryLater(int error, 205 void CloseSessionOnErrorAndNotifyFactoryLater(int error,
(...skipping 12 matching lines...) Expand all
218 218
219 // Returns true if |hostname| may be pooled onto this session. If this 219 // Returns true if |hostname| may be pooled onto this session. If this
220 // is a secure QUIC session, then |hostname| must match the certificate 220 // is a secure QUIC session, then |hostname| must match the certificate
221 // presented during the handshake. 221 // presented during the handshake.
222 bool CanPool(const std::string& hostname, PrivacyMode privacy_mode) const; 222 bool CanPool(const std::string& hostname, PrivacyMode privacy_mode) const;
223 223
224 const QuicServerId& server_id() const { return server_id_; } 224 const QuicServerId& server_id() const { return server_id_; }
225 225
226 QuicDisabledReason disabled_reason() const { return disabled_reason_; } 226 QuicDisabledReason disabled_reason() const { return disabled_reason_; }
227 227
228 // Migrates session onto new socket, i.e., starts reading from |socket|
229 // in addition to any previous sockets, and sets |writer| to be the new
230 // default writer. Returns true if socket was successfully added to the
231 // session and the session was successfully migrated to using the new socket.
232 // Returns false if number of migrations exceeds kMaxReadersPerQuicSession.
233 // Takes ownership of |socket|, |reader|, and |writer|.
234 bool MigrateToSocket(scoped_ptr<DatagramClientSocket> socket,
235 scoped_ptr<QuicPacketReader> reader,
236 scoped_ptr<QuicPacketWriter> writer);
237
238 // Returns current default socket. This is the socket over which all
239 // QUIC packets are sent. This default socket can change, so do not store the
240 // returned socket.
241 const DatagramClientSocket* GetDefaultSocket() const;
242
228 protected: 243 protected:
229 // QuicSession methods: 244 // QuicSession methods:
230 QuicSpdyStream* CreateIncomingDynamicStream(QuicStreamId id) override; 245 QuicSpdyStream* CreateIncomingDynamicStream(QuicStreamId id) override;
231 246
232 private: 247 private:
233 friend class test::QuicChromiumClientSessionPeer; 248 friend class test::QuicChromiumClientSessionPeer;
234 249
235 typedef std::set<Observer*> ObserverSet; 250 typedef std::set<Observer*> ObserverSet;
236 typedef std::list<StreamRequest*> StreamRequestQueue; 251 typedef std::list<StreamRequest*> StreamRequestQueue;
237 252
(...skipping 29 matching lines...) Expand all
267 // Notifies the factory that this session has been closed which will 282 // Notifies the factory that this session has been closed which will
268 // delete |this|. 283 // delete |this|.
269 void NotifyFactoryOfSessionClosed(); 284 void NotifyFactoryOfSessionClosed();
270 285
271 void OnConnectTimeout(); 286 void OnConnectTimeout();
272 287
273 QuicServerId server_id_; 288 QuicServerId server_id_;
274 bool require_confirmation_; 289 bool require_confirmation_;
275 scoped_ptr<QuicCryptoClientStream> crypto_stream_; 290 scoped_ptr<QuicCryptoClientStream> crypto_stream_;
276 QuicStreamFactory* stream_factory_; 291 QuicStreamFactory* stream_factory_;
277 scoped_ptr<DatagramClientSocket> socket_; 292 std::vector<scoped_ptr<DatagramClientSocket>> sockets_;
278 TransportSecurityState* transport_security_state_; 293 TransportSecurityState* transport_security_state_;
279 scoped_ptr<QuicServerInfo> server_info_; 294 scoped_ptr<QuicServerInfo> server_info_;
280 scoped_ptr<CertVerifyResult> cert_verify_result_; 295 scoped_ptr<CertVerifyResult> cert_verify_result_;
281 scoped_ptr<ct::CTVerifyResult> ct_verify_result_; 296 scoped_ptr<ct::CTVerifyResult> ct_verify_result_;
282 std::string pinning_failure_log_; 297 std::string pinning_failure_log_;
283 ObserverSet observers_; 298 ObserverSet observers_;
284 StreamRequestQueue stream_requests_; 299 StreamRequestQueue stream_requests_;
285 CompletionCallback callback_; 300 CompletionCallback callback_;
286 size_t num_total_streams_; 301 size_t num_total_streams_;
287 base::TaskRunner* task_runner_; 302 base::TaskRunner* task_runner_;
288 BoundNetLog net_log_; 303 BoundNetLog net_log_;
289 QuicPacketReader packet_reader_; 304 std::vector<scoped_ptr<QuicPacketReader>> packet_readers_;
290 base::TimeTicks dns_resolution_end_time_; 305 base::TimeTicks dns_resolution_end_time_;
291 base::TimeTicks handshake_start_; // Time the handshake was started. 306 base::TimeTicks handshake_start_; // Time the handshake was started.
292 scoped_ptr<QuicConnectionLogger> logger_; 307 scoped_ptr<QuicConnectionLogger> logger_;
293 // True when the session is going away, and streams may no longer be created 308 // True when the session is going away, and streams may no longer be created
294 // on this session. Existing stream will continue to be processed. 309 // on this session. Existing stream will continue to be processed.
295 bool going_away_; 310 bool going_away_;
296 QuicDisabledReason disabled_reason_; 311 QuicDisabledReason disabled_reason_;
297 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; 312 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_;
298 313
299 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); 314 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession);
300 }; 315 };
301 316
302 } // namespace net 317 } // namespace net
303 318
304 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ 319 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698