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

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

Issue 1775283002: [Domain Reliabiliy: net stack] Plumb received go away from server due to connection migration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add test in quic_stream_factory_test: go away with migration with port only Created 4 years, 9 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_
11 #define NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ 11 #define NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_
12 12
13 #include <stddef.h> 13 #include <stddef.h>
14 14
15 #include <string> 15 #include <string>
16 16
17 #include "base/containers/hash_tables.h" 17 #include "base/containers/hash_tables.h"
18 #include "base/containers/mru_cache.h" 18 #include "base/containers/mru_cache.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
21 #include "base/time/time.h" 21 #include "base/time/time.h"
22 #include "net/base/completion_callback.h" 22 #include "net/base/completion_callback.h"
23 #include "net/base/net_error_details.h"
23 #include "net/base/socket_performance_watcher.h" 24 #include "net/base/socket_performance_watcher.h"
24 #include "net/cert/ct_verify_result.h" 25 #include "net/cert/ct_verify_result.h"
25 #include "net/proxy/proxy_server.h" 26 #include "net/proxy/proxy_server.h"
26 #include "net/quic/quic_chromium_client_stream.h" 27 #include "net/quic/quic_chromium_client_stream.h"
27 #include "net/quic/quic_chromium_packet_reader.h" 28 #include "net/quic/quic_chromium_packet_reader.h"
28 #include "net/quic/quic_client_session_base.h" 29 #include "net/quic/quic_client_session_base.h"
29 #include "net/quic/quic_connection_logger.h" 30 #include "net/quic/quic_connection_logger.h"
30 #include "net/quic/quic_crypto_client_stream.h" 31 #include "net/quic/quic_crypto_client_stream.h"
31 #include "net/quic/quic_protocol.h" 32 #include "net/quic/quic_protocol.h"
32 #include "net/quic/quic_time.h" 33 #include "net/quic/quic_time.h"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // ERR_IO_PENDING is returned, then when the request is eventuallly 86 // ERR_IO_PENDING is returned, then when the request is eventuallly
86 // complete |callback| will be called. 87 // complete |callback| will be called.
87 int StartRequest(const base::WeakPtr<QuicChromiumClientSession>& session, 88 int StartRequest(const base::WeakPtr<QuicChromiumClientSession>& session,
88 QuicChromiumClientStream** stream, 89 QuicChromiumClientStream** stream,
89 const CompletionCallback& callback); 90 const CompletionCallback& callback);
90 91
91 // Cancels any pending stream creation request. May be called 92 // Cancels any pending stream creation request. May be called
92 // repeatedly. 93 // repeatedly.
93 void CancelRequest(); 94 void CancelRequest();
94 95
96 // Populates network error details for this stream request.
97 void PopulateNetErrorDetails(NetErrorDetails* details);
98
95 private: 99 private:
96 friend class QuicChromiumClientSession; 100 friend class QuicChromiumClientSession;
97 101
98 // Called by |session_| for an asynchronous request when the stream 102 // Called by |session_| for an asynchronous request when the stream
99 // request has finished successfully. 103 // request has finished successfully.
100 void OnRequestCompleteSuccess(QuicChromiumClientStream* stream); 104 void OnRequestCompleteSuccess(QuicChromiumClientStream* stream);
101 105
102 // Called by |session_| for an asynchronous request when the stream 106 // Called by |session_| for an asynchronous request when the stream
103 // request has finished with an error. Also called with ERR_ABORTED 107 // request has finished with an error. Also called with ERR_ABORTED
104 // if |session_| is destroyed while the stream request is still pending. 108 // if |session_| is destroyed while the stream request is still pending.
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 // Migrates session onto new socket, i.e., starts reading from |socket| 245 // Migrates session onto new socket, i.e., starts reading from |socket|
242 // in addition to any previous sockets, and sets |writer| to be the new 246 // in addition to any previous sockets, and sets |writer| to be the new
243 // default writer. Returns true if socket was successfully added to the 247 // default writer. Returns true if socket was successfully added to the
244 // session and the session was successfully migrated to using the new socket. 248 // session and the session was successfully migrated to using the new socket.
245 // Returns false if number of migrations exceeds kMaxReadersPerQuicSession. 249 // Returns false if number of migrations exceeds kMaxReadersPerQuicSession.
246 // Takes ownership of |socket|, |reader|, and |writer|. 250 // Takes ownership of |socket|, |reader|, and |writer|.
247 bool MigrateToSocket(scoped_ptr<DatagramClientSocket> socket, 251 bool MigrateToSocket(scoped_ptr<DatagramClientSocket> socket,
248 scoped_ptr<QuicChromiumPacketReader> reader, 252 scoped_ptr<QuicChromiumPacketReader> reader,
249 scoped_ptr<QuicPacketWriter> writer); 253 scoped_ptr<QuicPacketWriter> writer);
250 254
255 // Populates network error details for this session.
256 void PopulateNetErrorDetails(NetErrorDetails* details);
257
251 // Returns current default socket. This is the socket over which all 258 // Returns current default socket. This is the socket over which all
252 // QUIC packets are sent. This default socket can change, so do not store the 259 // QUIC packets are sent. This default socket can change, so do not store the
253 // returned socket. 260 // returned socket.
254 const DatagramClientSocket* GetDefaultSocket() const; 261 const DatagramClientSocket* GetDefaultSocket() const;
255 262
256 bool IsAuthorized(const std::string& hostname) override; 263 bool IsAuthorized(const std::string& hostname) override;
257 264
258 // Returns true if session has one ore more streams marked as non-migratable. 265 // Returns true if session has one ore more streams marked as non-migratable.
259 bool HasNonMigratableStreams() const; 266 bool HasNonMigratableStreams() const;
260 267
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 size_t num_total_streams_; 328 size_t num_total_streams_;
322 base::TaskRunner* task_runner_; 329 base::TaskRunner* task_runner_;
323 BoundNetLog net_log_; 330 BoundNetLog net_log_;
324 std::vector<scoped_ptr<QuicChromiumPacketReader>> packet_readers_; 331 std::vector<scoped_ptr<QuicChromiumPacketReader>> packet_readers_;
325 base::TimeTicks dns_resolution_end_time_; 332 base::TimeTicks dns_resolution_end_time_;
326 base::TimeTicks handshake_start_; // Time the handshake was started. 333 base::TimeTicks handshake_start_; // Time the handshake was started.
327 scoped_ptr<QuicConnectionLogger> logger_; 334 scoped_ptr<QuicConnectionLogger> logger_;
328 // True when the session is going away, and streams may no longer be created 335 // True when the session is going away, and streams may no longer be created
329 // on this session. Existing stream will continue to be processed. 336 // on this session. Existing stream will continue to be processed.
330 bool going_away_; 337 bool going_away_;
338 // True when the session receives a go away from server due to port migration.
339 bool received_goaway_because_of_migrating_port_;
Ryan Hamilton 2016/03/10 22:46:44 nit: port_migration_failed?
Zhongyi Shi 2016/03/11 03:56:32 Done.
331 QuicDisabledReason disabled_reason_; 340 QuicDisabledReason disabled_reason_;
332 TokenBindingSignatureMap token_binding_signatures_; 341 TokenBindingSignatureMap token_binding_signatures_;
333 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_; 342 base::WeakPtrFactory<QuicChromiumClientSession> weak_factory_;
334 343
335 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession); 344 DISALLOW_COPY_AND_ASSIGN(QuicChromiumClientSession);
336 }; 345 };
337 346
338 } // namespace net 347 } // namespace net
339 348
340 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_ 349 #endif // NET_QUIC_QUIC_CHROMIUM_CLIENT_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698