Chromium Code Reviews

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

Issue 2210693002: 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, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 176 matching lines...)
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 allow_server_migration, 195 bool allow_server_migration,
196 bool force_hol_blocking, 196 bool force_hol_blocking,
197 bool race_cert_verification,
198 const QuicTagVector& connection_options, 197 const QuicTagVector& connection_options,
199 bool enable_token_binding); 198 bool enable_token_binding);
200 ~QuicStreamFactory() override; 199 ~QuicStreamFactory() override;
201 200
202 // Returns true if there is an existing session for |server_id| or if the 201 // Returns true if there is an existing session for |server_id| or if the
203 // request can be pooled to an existing session to the IP address of 202 // request can be pooled to an existing session to the IP address of
204 // |destination|. 203 // |destination|.
205 bool CanUseExistingSession(const QuicServerId& server_id, 204 bool CanUseExistingSession(const QuicServerId& server_id,
206 const HostPortPair& destination); 205 const HostPortPair& destination);
207 206
(...skipping 159 matching lines...)
367 void set_enable_connection_racing(bool enable_connection_racing) { 366 void set_enable_connection_racing(bool enable_connection_racing) {
368 enable_connection_racing_ = enable_connection_racing; 367 enable_connection_racing_ = enable_connection_racing;
369 } 368 }
370 369
371 int socket_receive_buffer_size() const { return socket_receive_buffer_size_; } 370 int socket_receive_buffer_size() const { return socket_receive_buffer_size_; }
372 371
373 bool delay_tcp_race() const { return delay_tcp_race_; } 372 bool delay_tcp_race() const { return delay_tcp_race_; }
374 373
375 private: 374 private:
376 class Job; 375 class Job;
377 class CertVerifierJob;
378 friend class test::QuicStreamFactoryPeer; 376 friend class test::QuicStreamFactoryPeer;
379 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryTest, QuicLossyProxyMarkedAsBad); 377 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryTest, QuicLossyProxyMarkedAsBad);
380 378
381 typedef std::map<QuicServerId, QuicChromiumClientSession*> SessionMap; 379 typedef std::map<QuicServerId, QuicChromiumClientSession*> SessionMap;
382 typedef std::map<QuicChromiumClientSession*, QuicSessionKey> SessionIdMap; 380 typedef std::map<QuicChromiumClientSession*, QuicSessionKey> SessionIdMap;
383 typedef std::set<QuicSessionKey> AliasSet; 381 typedef std::set<QuicSessionKey> AliasSet;
384 typedef std::map<QuicChromiumClientSession*, AliasSet> SessionAliasMap; 382 typedef std::map<QuicChromiumClientSession*, AliasSet> SessionAliasMap;
385 typedef std::set<QuicChromiumClientSession*> SessionSet; 383 typedef std::set<QuicChromiumClientSession*> SessionSet;
386 typedef std::map<IPEndPoint, SessionSet> IPAliasMap; 384 typedef std::map<IPEndPoint, SessionSet> IPAliasMap;
387 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap; 385 typedef std::map<QuicServerId, QuicCryptoClientConfig*> CryptoConfigMap;
388 typedef std::set<Job*> JobSet; 386 typedef std::set<Job*> JobSet;
389 typedef std::map<QuicServerId, JobSet> JobMap; 387 typedef std::map<QuicServerId, JobSet> JobMap;
390 typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap; 388 typedef std::map<QuicStreamRequest*, QuicServerId> RequestMap;
391 typedef std::set<QuicStreamRequest*> RequestSet; 389 typedef std::set<QuicStreamRequest*> RequestSet;
392 typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap; 390 typedef std::map<QuicServerId, RequestSet> ServerIDRequestsMap;
393 typedef std::deque<enum QuicChromiumClientSession::QuicDisabledReason> 391 typedef std::deque<enum QuicChromiumClientSession::QuicDisabledReason>
394 DisabledReasonsQueue; 392 DisabledReasonsQueue;
395 typedef std::map<QuicServerId, std::unique_ptr<CertVerifierJob>>
396 CertVerifierJobMap;
397 393
398 enum FactoryStatus { 394 enum FactoryStatus {
399 OPEN, // New streams may be created. 395 OPEN, // New streams may be created.
400 CLOSED, // No new streams may be created temporarily. 396 CLOSED, // No new streams may be created temporarily.
401 DISABLED // No more streams may be created until the network changes. 397 DISABLED // No more streams may be created until the network changes.
402 }; 398 };
403 399
404 // Creates a job which doesn't wait for server config to be loaded from the 400 // Creates a job which doesn't wait for server config to be loaded from the
405 // disk cache. This job is started via a PostTask. 401 // disk cache. This job is started via a PostTask.
406 void CreateAuxilaryJob(const QuicSessionKey& key, 402 void CreateAuxilaryJob(const QuicSessionKey& key,
407 int cert_verify_flags, 403 int cert_verify_flags,
408 const BoundNetLog& net_log); 404 const BoundNetLog& net_log);
409 405
410 // Returns a newly created QuicHttpStream owned by the caller. 406 // Returns a newly created QuicHttpStream owned by the caller.
411 std::unique_ptr<QuicHttpStream> CreateFromSession( 407 std::unique_ptr<QuicHttpStream> CreateFromSession(
412 QuicChromiumClientSession* session); 408 QuicChromiumClientSession* session);
413 409
414 bool OnResolution(const QuicSessionKey& key, const AddressList& address_list); 410 bool OnResolution(const QuicSessionKey& key, const AddressList& address_list);
415 void OnJobComplete(Job* job, int rv); 411 void OnJobComplete(Job* job, int rv);
416 void OnCertVerifyJobComplete(CertVerifierJob* job, int rv);
417 bool HasActiveSession(const QuicServerId& server_id) const; 412 bool HasActiveSession(const QuicServerId& server_id) const;
418 bool HasActiveJob(const QuicServerId& server_id) const; 413 bool HasActiveJob(const QuicServerId& server_id) const;
419 bool HasActiveCertVerifierJob(const QuicServerId& server_id) const;
420 int CreateSession(const QuicSessionKey& key, 414 int CreateSession(const QuicSessionKey& key,
421 int cert_verify_flags, 415 int cert_verify_flags,
422 std::unique_ptr<QuicServerInfo> quic_server_info, 416 std::unique_ptr<QuicServerInfo> quic_server_info,
423 const AddressList& address_list, 417 const AddressList& address_list,
424 base::TimeTicks dns_resolution_end_time, 418 base::TimeTicks dns_resolution_end_time,
425 const BoundNetLog& net_log, 419 const BoundNetLog& net_log,
426 QuicChromiumClientSession** session); 420 QuicChromiumClientSession** session);
427 void ActivateSession(const QuicSessionKey& key, 421 void ActivateSession(const QuicSessionKey& key,
428 QuicChromiumClientSession* session); 422 QuicChromiumClientSession* session);
429 423
430 // Returns |srtt| in micro seconds from ServerNetworkStats. Returns 0 if there 424 // Returns |srtt| in micro seconds from ServerNetworkStats. Returns 0 if there
431 // is no |http_server_properties_| or if |http_server_properties_| doesn't 425 // is no |http_server_properties_| or if |http_server_properties_| doesn't
432 // have ServerNetworkStats for the given |server_id|. 426 // have ServerNetworkStats for the given |server_id|.
433 int64_t GetServerNetworkStatsSmoothedRttInMicroseconds( 427 int64_t GetServerNetworkStatsSmoothedRttInMicroseconds(
434 const QuicServerId& server_id) const; 428 const QuicServerId& server_id) const;
435 429
436 // Helper methods. 430 // Helper methods.
437 bool WasQuicRecentlyBroken(const QuicServerId& server_id) const; 431 bool WasQuicRecentlyBroken(const QuicServerId& server_id) const;
438 432
439 bool CryptoConfigCacheIsEmpty(const QuicServerId& server_id); 433 bool CryptoConfigCacheIsEmpty(const QuicServerId& server_id);
440 434
441 // Starts an asynchronous job for cert verification if
442 // |race_cert_verification_| is enabled and if there are cached certs for the
443 // given |server_id|.
444 QuicAsyncStatus StartCertVerifyJob(const QuicServerId& server_id,
445 int cert_verify_flags,
446 const BoundNetLog& net_log);
447
448 // Initializes the cached state associated with |server_id| in 435 // Initializes the cached state associated with |server_id| in
449 // |crypto_config_| with the information in |server_info|. Populates 436 // |crypto_config_| with the information in |server_info|. Populates
450 // |connection_id| with the next server designated connection id, 437 // |connection_id| with the next server designated connection id,
451 // if any, and otherwise leaves it unchanged. 438 // if any, and otherwise leaves it unchanged.
452 void InitializeCachedStateInCryptoConfig( 439 void InitializeCachedStateInCryptoConfig(
453 const QuicServerId& server_id, 440 const QuicServerId& server_id,
454 const std::unique_ptr<QuicServerInfo>& server_info, 441 const std::unique_ptr<QuicServerInfo>& server_info,
455 QuicConnectionId* connection_id); 442 QuicConnectionId* connection_id);
456 443
457 // Initialize |quic_supported_servers_at_startup_| with the list of servers 444 // Initialize |quic_supported_servers_at_startup_| with the list of servers
(...skipping 57 matching lines...)
515 // Origins which have gone away recently. 502 // Origins which have gone away recently.
516 AliasSet gone_away_aliases_; 503 AliasSet gone_away_aliases_;
517 504
518 const QuicConfig config_; 505 const QuicConfig config_;
519 QuicCryptoClientConfig crypto_config_; 506 QuicCryptoClientConfig crypto_config_;
520 507
521 JobMap active_jobs_; 508 JobMap active_jobs_;
522 ServerIDRequestsMap job_requests_map_; 509 ServerIDRequestsMap job_requests_map_;
523 RequestMap active_requests_; 510 RequestMap active_requests_;
524 511
525 CertVerifierJobMap active_cert_verifier_jobs_;
526
527 QuicVersionVector supported_versions_; 512 QuicVersionVector supported_versions_;
528 513
529 // Determine if we should consistently select a client UDP port. If false, 514 // Determine if we should consistently select a client UDP port. If false,
530 // then we will just let the OS select a random client port for each new 515 // then we will just let the OS select a random client port for each new
531 // connection. 516 // connection.
532 bool enable_port_selection_; 517 bool enable_port_selection_;
533 518
534 // Set if we always require handshake confirmation. If true, this will 519 // Set if we always require handshake confirmation. If true, this will
535 // introduce at least one RTT for the handshake before the client sends data. 520 // introduce at least one RTT for the handshake before the client sends data.
536 bool always_require_handshake_confirmation_; 521 bool always_require_handshake_confirmation_;
(...skipping 69 matching lines...)
606 // experiences poor connectivity. 591 // experiences poor connectivity.
607 const bool migrate_sessions_early_; 592 const bool migrate_sessions_early_;
608 593
609 // If set, allows migration of connection to server-specified alternate 594 // If set, allows migration of connection to server-specified alternate
610 // server address. 595 // server address.
611 const bool allow_server_migration_; 596 const bool allow_server_migration_;
612 597
613 // If set, force HOL blocking. For measurement purposes. 598 // If set, force HOL blocking. For measurement purposes.
614 const bool force_hol_blocking_; 599 const bool force_hol_blocking_;
615 600
616 // Set if cert verification is to be raced with host resolution.
617 bool race_cert_verification_;
618
619 // Each profile will (probably) have a unique port_seed_ value. This value 601 // Each profile will (probably) have a unique port_seed_ value. This value
620 // is used to help seed a pseudo-random number generator (PortSuggester) so 602 // is used to help seed a pseudo-random number generator (PortSuggester) so
621 // that we consistently (within this profile) suggest the same ephemeral 603 // that we consistently (within this profile) suggest the same ephemeral
622 // port when we re-connect to any given server/port. The differences between 604 // port when we re-connect to any given server/port. The differences between
623 // profiles (probablistically) prevent two profiles from colliding in their 605 // profiles (probablistically) prevent two profiles from colliding in their
624 // ephemeral port requests. 606 // ephemeral port requests.
625 uint64_t port_seed_; 607 uint64_t port_seed_;
626 608
627 // Local address of socket that was created in CreateSession. 609 // Local address of socket that was created in CreateSession.
628 IPEndPoint local_address_; 610 IPEndPoint local_address_;
(...skipping 15 matching lines...)
644 const scoped_refptr<SSLConfigService> ssl_config_service_; 626 const scoped_refptr<SSLConfigService> ssl_config_service_;
645 627
646 base::WeakPtrFactory<QuicStreamFactory> weak_factory_; 628 base::WeakPtrFactory<QuicStreamFactory> weak_factory_;
647 629
648 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory); 630 DISALLOW_COPY_AND_ASSIGN(QuicStreamFactory);
649 }; 631 };
650 632
651 } // namespace net 633 } // namespace net
652 634
653 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_ 635 #endif // NET_QUIC_QUIC_STREAM_FACTORY_H_
OLDNEW
« no previous file with comments | « net/quic/chromium/crypto/proof_verifier_chromium_test.cc ('k') | net/quic/chromium/quic_stream_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine