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: Fixes a few scoped_ptr issues. Created 5 years, 1 month 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 // Returns false if number of migrations exceeds kMaxReadersPerQuicSession.
229 // Takes ownership of |socket|, |reader|, and |writer|.
230 bool MigrateToSocket(scoped_ptr<DatagramClientSocket> socket,
231 scoped_ptr<QuicPacketReader> reader,
232 scoped_ptr<QuicPacketWriter> writer);
233
224 protected: 234 protected:
225 // QuicSession methods: 235 // QuicSession methods:
226 QuicSpdyStream* CreateIncomingDynamicStream(QuicStreamId id) override; 236 QuicSpdyStream* CreateIncomingDynamicStream(QuicStreamId id) override;
227 237
228 private: 238 private:
229 friend class test::QuicChromiumClientSessionPeer; 239 friend class test::QuicChromiumClientSessionPeer;
230 240
231 typedef std::set<Observer*> ObserverSet; 241 typedef std::set<Observer*> ObserverSet;
232 typedef std::list<StreamRequest*> StreamRequestQueue; 242 typedef std::list<StreamRequest*> StreamRequestQueue;
233 243
(...skipping 29 matching lines...) Expand all
263 // Notifies the factory that this session has been closed which will 273 // Notifies the factory that this session has been closed which will
264 // delete |this|. 274 // delete |this|.
265 void NotifyFactoryOfSessionClosed(); 275 void NotifyFactoryOfSessionClosed();
266 276
267 void OnConnectTimeout(); 277 void OnConnectTimeout();
268 278
269 QuicServerId server_id_; 279 QuicServerId server_id_;
270 bool require_confirmation_; 280 bool require_confirmation_;
271 scoped_ptr<QuicCryptoClientStream> crypto_stream_; 281 scoped_ptr<QuicCryptoClientStream> crypto_stream_;
272 QuicStreamFactory* stream_factory_; 282 QuicStreamFactory* stream_factory_;
273 scoped_ptr<DatagramClientSocket> socket_; 283 std::vector<scoped_ptr<DatagramClientSocket>> sockets_;
274 TransportSecurityState* transport_security_state_; 284 TransportSecurityState* transport_security_state_;
275 scoped_ptr<QuicServerInfo> server_info_; 285 scoped_ptr<QuicServerInfo> server_info_;
276 scoped_ptr<CertVerifyResult> cert_verify_result_; 286 scoped_ptr<CertVerifyResult> cert_verify_result_;
277 std::string pinning_failure_log_; 287 std::string pinning_failure_log_;
278 ObserverSet observers_; 288 ObserverSet observers_;
279 StreamRequestQueue stream_requests_; 289 StreamRequestQueue stream_requests_;
280 CompletionCallback callback_; 290 CompletionCallback callback_;
281 size_t num_total_streams_; 291 size_t num_total_streams_;
282 base::TaskRunner* task_runner_; 292 base::TaskRunner* task_runner_;
283 BoundNetLog net_log_; 293 BoundNetLog net_log_;
284 QuicPacketReader packet_reader_; 294 std::vector<scoped_ptr<QuicPacketReader>> packet_readers_;
285 base::TimeTicks dns_resolution_end_time_; 295 base::TimeTicks dns_resolution_end_time_;
286 base::TimeTicks handshake_start_; // Time the handshake was started. 296 base::TimeTicks handshake_start_; // Time the handshake was started.
287 scoped_ptr<QuicConnectionLogger> logger_; 297 scoped_ptr<QuicConnectionLogger> logger_;
288 // True when the session is going away, and streams may no longer be created 298 // 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. 299 // on this session. Existing stream will continue to be processed.
290 bool going_away_; 300 bool going_away_;
291 QuicDisabledReason disabled_reason_; 301 QuicDisabledReason disabled_reason_;
292 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; 302 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_;
293 303
294 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); 304 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession);
295 }; 305 };
296 306
297 } // namespace net 307 } // namespace net
298 308
299 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ 309 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698