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

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

Issue 524463004: Adds plumbing for always requiring handshake confirmation in QUIC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More nits fixed, test added, and formatting. Created 6 years, 3 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 #ifndef NET_QUIC_QUIC_STREAM_FACTORY_H_ 5 #ifndef NET_QUIC_QUIC_STREAM_FACTORY_H_
6 #define NET_QUIC_QUIC_STREAM_FACTORY_H_ 6 #define NET_QUIC_QUIC_STREAM_FACTORY_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 ChannelIDService* channel_id_service, 96 ChannelIDService* channel_id_service,
97 TransportSecurityState* transport_security_state, 97 TransportSecurityState* transport_security_state,
98 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, 98 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory,
99 QuicRandom* random_generator, 99 QuicRandom* random_generator,
100 QuicClock* clock, 100 QuicClock* clock,
101 size_t max_packet_length, 101 size_t max_packet_length,
102 const std::string& user_agent_id, 102 const std::string& user_agent_id,
103 const QuicVersionVector& supported_versions, 103 const QuicVersionVector& supported_versions,
104 bool enable_port_selection, 104 bool enable_port_selection,
105 bool enable_time_based_loss_detection, 105 bool enable_time_based_loss_detection,
106 bool always_require_handshake_confirmation,
106 const QuicTagVector& connection_options); 107 const QuicTagVector& connection_options);
107 virtual ~QuicStreamFactory(); 108 virtual ~QuicStreamFactory();
108 109
109 // Creates a new QuicHttpStream to |host_port_pair| which will be 110 // Creates a new QuicHttpStream to |host_port_pair| which will be
110 // owned by |request|. |is_https| specifies if the protocol is https or not. 111 // owned by |request|. |is_https| specifies if the protocol is https or not.
111 // If a matching session already exists, this method will return OK. If no 112 // If a matching session already exists, this method will return OK. If no
112 // matching session exists, this will return ERR_IO_PENDING and will invoke 113 // matching session exists, this will return ERR_IO_PENDING and will invoke
113 // OnRequestComplete asynchronously. 114 // OnRequestComplete asynchronously.
114 int Create(const HostPortPair& host_port_pair, 115 int Create(const HostPortPair& host_port_pair,
115 bool is_https, 116 bool is_https,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 // Until the servers support roaming, close all connections when the local 148 // Until the servers support roaming, close all connections when the local
148 // IP address changes. 149 // IP address changes.
149 virtual void OnIPAddressChanged() OVERRIDE; 150 virtual void OnIPAddressChanged() OVERRIDE;
150 151
151 // CertDatabase::Observer methods: 152 // CertDatabase::Observer methods:
152 153
153 // We close all sessions when certificate database is changed. 154 // We close all sessions when certificate database is changed.
154 virtual void OnCertAdded(const X509Certificate* cert) OVERRIDE; 155 virtual void OnCertAdded(const X509Certificate* cert) OVERRIDE;
155 virtual void OnCACertChanged(const X509Certificate* cert) OVERRIDE; 156 virtual void OnCACertChanged(const X509Certificate* cert) OVERRIDE;
156 157
157 bool require_confirmation() const { return require_confirmation_; } 158 bool require_confirmation() const {
Ryan Hamilton 2014/09/02 19:28:22 Hm. This method is named in hacker_case which typi
159 return require_confirmation_ || always_require_handshake_confirmation_;
160 }
158 161
159 void set_require_confirmation(bool require_confirmation) { 162 void set_require_confirmation(bool require_confirmation) {
160 require_confirmation_ = require_confirmation; 163 require_confirmation_ = require_confirmation;
161 } 164 }
162 165
163 QuicConnectionHelper* helper() { return helper_.get(); } 166 QuicConnectionHelper* helper() { return helper_.get(); }
164 167
165 bool enable_port_selection() const { return enable_port_selection_; } 168 bool enable_port_selection() const { return enable_port_selection_; }
166 169
167 bool has_quic_server_info_factory() { 170 bool has_quic_server_info_factory() {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 JobRequestsMap job_requests_map_; 270 JobRequestsMap job_requests_map_;
268 RequestMap active_requests_; 271 RequestMap active_requests_;
269 272
270 QuicVersionVector supported_versions_; 273 QuicVersionVector supported_versions_;
271 274
272 // Determine if we should consistently select a client UDP port. If false, 275 // Determine if we should consistently select a client UDP port. If false,
273 // then we will just let the OS select a random client port for each new 276 // then we will just let the OS select a random client port for each new
274 // connection. 277 // connection.
275 bool enable_port_selection_; 278 bool enable_port_selection_;
276 279
280 // Set if we always require handshake confirmation. If true, this will
281 // introduce at least one RTT for the handshake before the client sends data.
282 bool always_require_handshake_confirmation_;
283
277 // Each profile will (probably) have a unique port_seed_ value. This value is 284 // Each profile will (probably) have a unique port_seed_ value. This value is
278 // used to help seed a pseudo-random number generator (PortSuggester) so that 285 // used to help seed a pseudo-random number generator (PortSuggester) so that
279 // we consistently (within this profile) suggest the same ephemeral port when 286 // we consistently (within this profile) suggest the same ephemeral port when
280 // we re-connect to any given server/port. The differences between profiles 287 // we re-connect to any given server/port. The differences between profiles
281 // (probablistically) prevent two profiles from colliding in their ephemeral 288 // (probablistically) prevent two profiles from colliding in their ephemeral
282 // port requests. 289 // port requests.
283 uint64 port_seed_; 290 uint64 port_seed_;
284 291
285 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; 292 base::WeakPtrFactory<QuicStreamFactory> weak_factory_;
286 293
287 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); 294 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory);
288 }; 295 };
289 296
290 } // namespace net 297 } // namespace net
291 298
292 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ 299 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698