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

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

Issue 2137843002: Revert of QUIC - Race Cert Verification with host resolution if certs are (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « net/quic/crypto/proof_verifier_chromium_test.cc ('k') | net/quic/quic_stream_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 int threshold_public_resets_post_handshake, 186 int threshold_public_resets_post_handshake,
187 int socket_receive_buffer_size, 187 int socket_receive_buffer_size,
188 bool delay_tcp_race, 188 bool delay_tcp_race,
189 int max_server_configs_stored_in_properties, 189 int max_server_configs_stored_in_properties,
190 bool close_sessions_on_ip_change, 190 bool close_sessions_on_ip_change,
191 bool disable_quic_on_timeout_with_open_streams, 191 bool disable_quic_on_timeout_with_open_streams,
192 int idle_connection_timeout_seconds, 192 int idle_connection_timeout_seconds,
193 bool migrate_sessions_on_network_change, 193 bool migrate_sessions_on_network_change,
194 bool migrate_sessions_early, 194 bool migrate_sessions_early,
195 bool force_hol_blocking, 195 bool force_hol_blocking,
196 bool race_cert_verification,
197 const QuicTagVector& connection_options, 196 const QuicTagVector& connection_options,
198 bool enable_token_binding); 197 bool enable_token_binding);
199 ~QuicStreamFactory() override; 198 ~QuicStreamFactory() override;
200 199
201 // Returns true if there is an existing session for |server_id| or if the 200 // Returns true if there is an existing session for |server_id| or if the
202 // request can be pooled to an existing session to the IP address of 201 // request can be pooled to an existing session to the IP address of
203 // |destination|. 202 // |destination|.
204 bool CanUseExistingSession(const QuicServerId& server_id, 203 bool CanUseExistingSession(const QuicServerId& server_id,
205 const HostPortPair& destination); 204 const HostPortPair& destination);
206 205
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 void set_enable_connection_racing(bool enable_connection_racing) { 358 void set_enable_connection_racing(bool enable_connection_racing) {
360 enable_connection_racing_ = enable_connection_racing; 359 enable_connection_racing_ = enable_connection_racing;
361 } 360 }
362 361
363 int socket_receive_buffer_size() const { return socket_receive_buffer_size_; } 362 int socket_receive_buffer_size() const { return socket_receive_buffer_size_; }
364 363
365 bool delay_tcp_race() const { return delay_tcp_race_; } 364 bool delay_tcp_race() const { return delay_tcp_race_; }
366 365
367 private: 366 private:
368 class Job; 367 class Job;
369 class CertVerifierJob;
370 friend class test::QuicStreamFactoryPeer; 368 friend class test::QuicStreamFactoryPeer;
371 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryTest, QuicLossyProxyMarkedAsBad); 369 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryTest, QuicLossyProxyMarkedAsBad);
372 370
373 typedef std::map<QuicServerId, QuicChromiumClientSession*> SessionMap; 371 typedef std::map<QuicServerId, QuicChromiumClientSession*> SessionMap;
374 typedef std::map<QuicChromiumClientSession*, QuicSessionKey> SessionIdMap; 372 typedef std::map<QuicChromiumClientSession*, QuicSessionKey> SessionIdMap;
375 typedef std::set<QuicSessionKey> AliasSet; 373 typedef std::set<QuicSessionKey> AliasSet;
376 typedef std::map<QuicChromiumClientSession*, AliasSet> SessionAliasMap; 374 typedef std::map<QuicChromiumClientSession*, AliasSet> SessionAliasMap;
377 typedef std::set<QuicChromiumClientSession*> SessionSet; 375 typedef std::set<QuicChromiumClientSession*> SessionSet;
378 typedef std::map<IPEndPoint, SessionSet> IPAliasMap; 376 typedef std::map<IPEndPoint, SessionSet> IPAliasMap;
379 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap; 377 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap;
380 typedef std::set<Job*> JobSet; 378 typedef std::set<Job*> JobSet;
381 typedef std::map<QuicServerId, JobSet> JobMap; 379 typedef std::map<QuicServerId, JobSet> JobMap;
382 typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap; 380 typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap;
383 typedef std::set<QuicStreamRequest*> RequestSet; 381 typedef std::set<QuicStreamRequest*> RequestSet;
384 typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap; 382 typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap;
385 typedef std::deque<enum QuicChromiumClientSession::QuicDisabledReason> 383 typedef std::deque<enum QuicChromiumClientSession::QuicDisabledReason>
386 DisabledReasonsQueue; 384 DisabledReasonsQueue;
387 typedef std::map<QuicServerId, std::unique_ptr<CertVerifierJob>>
388 CertVerifierJobMap;
389 385
390 enum FactoryStatus { 386 enum FactoryStatus {
391 OPEN, // New streams may be created. 387 OPEN, // New streams may be created.
392 CLOSED, // No new streams may be created temporarily. 388 CLOSED, // No new streams may be created temporarily.
393 DISABLED // No more streams may be created until the network changes. 389 DISABLED // No more streams may be created until the network changes.
394 }; 390 };
395 391
396 // Creates a job which doesn't wait for server config to be loaded from the 392 // Creates a job which doesn't wait for server config to be loaded from the
397 // disk cache. This job is started via a PostTask. 393 // disk cache. This job is started via a PostTask.
398 void CreateAuxilaryJob(const QuicSessionKey& key, 394 void CreateAuxilaryJob(const QuicSessionKey& key,
399 int cert_verify_flags, 395 int cert_verify_flags,
400 const BoundNetLog& net_log); 396 const BoundNetLog& net_log);
401 397
402 // Returns a newly created QuicHttpStream owned by the caller. 398 // Returns a newly created QuicHttpStream owned by the caller.
403 std::unique_ptr<QuicHttpStream> CreateFromSession( 399 std::unique_ptr<QuicHttpStream> CreateFromSession(
404 QuicChromiumClientSession* session); 400 QuicChromiumClientSession* session);
405 401
406 bool OnResolution(const QuicSessionKey& key, const AddressList& address_list); 402 bool OnResolution(const QuicSessionKey& key, const AddressList& address_list);
407 void OnJobComplete(Job* job, int rv); 403 void OnJobComplete(Job* job, int rv);
408 void OnCertVerifyJobComplete(CertVerifierJob* job, int rv);
409 bool HasActiveSession(const QuicServerId& server_id) const; 404 bool HasActiveSession(const QuicServerId& server_id) const;
410 bool HasActiveJob(const QuicServerId& server_id) const; 405 bool HasActiveJob(const QuicServerId& server_id) const;
411 bool HasActiveCertVerifierJob(const QuicServerId& server_id) const;
412 int CreateSession(const QuicSessionKey& key, 406 int CreateSession(const QuicSessionKey& key,
413 int cert_verify_flags, 407 int cert_verify_flags,
414 std::unique_ptr<QuicServerInfo> quic_server_info, 408 std::unique_ptr<QuicServerInfo> quic_server_info,
415 const AddressList& address_list, 409 const AddressList& address_list,
416 base::TimeTicks dns_resolution_end_time, 410 base::TimeTicks dns_resolution_end_time,
417 const BoundNetLog& net_log, 411 const BoundNetLog& net_log,
418 QuicChromiumClientSession** session); 412 QuicChromiumClientSession** session);
419 void ActivateSession(const QuicSessionKey& key, 413 void ActivateSession(const QuicSessionKey& key,
420 QuicChromiumClientSession* session); 414 QuicChromiumClientSession* session);
421 415
422 // Returns |srtt| in micro seconds from ServerNetworkStats. Returns 0 if there 416 // Returns |srtt| in micro seconds from ServerNetworkStats. Returns 0 if there
423 // is no |http_server_properties_| or if |http_server_properties_| doesn't 417 // is no |http_server_properties_| or if |http_server_properties_| doesn't
424 // have ServerNetworkStats for the given |server_id|. 418 // have ServerNetworkStats for the given |server_id|.
425 int64_t GetServerNetworkStatsSmoothedRttInMicroseconds( 419 int64_t GetServerNetworkStatsSmoothedRttInMicroseconds(
426 const QuicServerId& server_id) const; 420 const QuicServerId& server_id) const;
427 421
428 // Helper methods. 422 // Helper methods.
429 bool WasQuicRecentlyBroken(const QuicServerId& server_id) const; 423 bool WasQuicRecentlyBroken(const QuicServerId& server_id) const;
430 424
431 bool CryptoConfigCacheIsEmpty(const QuicServerId& server_id); 425 bool CryptoConfigCacheIsEmpty(const QuicServerId& server_id);
432 426
433 // Starts an asynchronous job for cert verification if
434 // |race_cert_verification_| is enabled and if there are cached certs for the
435 // given |server_id|.
436 QuicAsyncStatus StartCertVerifyJob(const QuicServerId& server_id,
437 int cert_verify_flags,
438 const BoundNetLog& net_log);
439
440 // Initializes the cached state associated with |server_id| in 427 // Initializes the cached state associated with |server_id| in
441 // |crypto_config_| with the information in |server_info|. Populates 428 // |crypto_config_| with the information in |server_info|. Populates
442 // |connection_id| with the next server designated connection id, 429 // |connection_id| with the next server designated connection id,
443 // if any, and otherwise leaves it unchanged. 430 // if any, and otherwise leaves it unchanged.
444 void InitializeCachedStateInCryptoConfig( 431 void InitializeCachedStateInCryptoConfig(
445 const QuicServerId& server_id, 432 const QuicServerId& server_id,
446 const std::unique_ptr<QuicServerInfo>& server_info, 433 const std::unique_ptr<QuicServerInfo>& server_info,
447 QuicConnectionId* connection_id); 434 QuicConnectionId* connection_id);
448 435
449 // Initialize |quic_supported_servers_at_startup_| with the list of servers 436 // Initialize |quic_supported_servers_at_startup_| with the list of servers
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 // Origins which have gone away recently. 484 // Origins which have gone away recently.
498 AliasSet gone_away_aliases_; 485 AliasSet gone_away_aliases_;
499 486
500 const QuicConfig config_; 487 const QuicConfig config_;
501 QuicCryptoClientConfig crypto_config_; 488 QuicCryptoClientConfig crypto_config_;
502 489
503 JobMap active_jobs_; 490 JobMap active_jobs_;
504 ServerIDRequestsMap job_requests_map_; 491 ServerIDRequestsMap job_requests_map_;
505 RequestMap active_requests_; 492 RequestMap active_requests_;
506 493
507 CertVerifierJobMap active_cert_verifier_jobs_;
508
509 QuicVersionVector supported_versions_; 494 QuicVersionVector supported_versions_;
510 495
511 // Determine if we should consistently select a client UDP port. If false, 496 // Determine if we should consistently select a client UDP port. If false,
512 // then we will just let the OS select a random client port for each new 497 // then we will just let the OS select a random client port for each new
513 // connection. 498 // connection.
514 bool enable_port_selection_; 499 bool enable_port_selection_;
515 500
516 // Set if we always require handshake confirmation. If true, this will 501 // Set if we always require handshake confirmation. If true, this will
517 // introduce at least one RTT for the handshake before the client sends data. 502 // introduce at least one RTT for the handshake before the client sends data.
518 bool always_require_handshake_confirmation_; 503 bool always_require_handshake_confirmation_;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 // interface changes. 569 // interface changes.
585 const bool migrate_sessions_on_network_change_; 570 const bool migrate_sessions_on_network_change_;
586 571
587 // Set if early migration should be attempted when the connection 572 // Set if early migration should be attempted when the connection
588 // experiences poor connectivity. 573 // experiences poor connectivity.
589 const bool migrate_sessions_early_; 574 const bool migrate_sessions_early_;
590 575
591 // If set, force HOL blocking. For measurement purposes. 576 // If set, force HOL blocking. For measurement purposes.
592 const bool force_hol_blocking_; 577 const bool force_hol_blocking_;
593 578
594 // Set if cert verification is to be raced with host resolution.
595 bool race_cert_verification_;
596
597 // Each profile will (probably) have a unique port_seed_ value. This value 579 // Each profile will (probably) have a unique port_seed_ value. This value
598 // is used to help seed a pseudo-random number generator (PortSuggester) so 580 // is used to help seed a pseudo-random number generator (PortSuggester) so
599 // that we consistently (within this profile) suggest the same ephemeral 581 // that we consistently (within this profile) suggest the same ephemeral
600 // port when we re-connect to any given server/port. The differences between 582 // port when we re-connect to any given server/port. The differences between
601 // profiles (probablistically) prevent two profiles from colliding in their 583 // profiles (probablistically) prevent two profiles from colliding in their
602 // ephemeral port requests. 584 // ephemeral port requests.
603 uint64_t port_seed_; 585 uint64_t port_seed_;
604 586
605 // Local address of socket that was created in CreateSession. 587 // Local address of socket that was created in CreateSession.
606 IPEndPoint local_address_; 588 IPEndPoint local_address_;
(...skipping 15 matching lines...) Expand all
622 const scoped_refptr<SSLConfigService> ssl_config_service_; 604 const scoped_refptr<SSLConfigService> ssl_config_service_;
623 605
624 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; 606 base::WeakPtrFactory<QuicStreamFactory> weak_factory_;
625 607
626 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); 608 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory);
627 }; 609 };
628 610
629 } // namespace net 611 } // namespace net
630 612
631 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ 613 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_
OLDNEW
« no previous file with comments | « net/quic/crypto/proof_verifier_chromium_test.cc ('k') | net/quic/quic_stream_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698