| OLD | NEW |
| 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 #include "net/quic/quic_stream_factory.h" | 5 #include "net/quic/quic_stream_factory.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/cpu.h" | 9 #include "base/cpu.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 TransportSecurityState* transport_security_state, | 475 TransportSecurityState* transport_security_state, |
| 476 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, | 476 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, |
| 477 QuicRandom* random_generator, | 477 QuicRandom* random_generator, |
| 478 QuicClock* clock, | 478 QuicClock* clock, |
| 479 size_t max_packet_length, | 479 size_t max_packet_length, |
| 480 const std::string& user_agent_id, | 480 const std::string& user_agent_id, |
| 481 const QuicVersionVector& supported_versions, | 481 const QuicVersionVector& supported_versions, |
| 482 bool enable_port_selection, | 482 bool enable_port_selection, |
| 483 bool enable_time_based_loss_detection, | 483 bool enable_time_based_loss_detection, |
| 484 bool always_require_handshake_confirmation, | 484 bool always_require_handshake_confirmation, |
| 485 bool disable_connection_pooling, |
| 485 const QuicTagVector& connection_options) | 486 const QuicTagVector& connection_options) |
| 486 : require_confirmation_(true), | 487 : require_confirmation_(true), |
| 487 host_resolver_(host_resolver), | 488 host_resolver_(host_resolver), |
| 488 client_socket_factory_(client_socket_factory), | 489 client_socket_factory_(client_socket_factory), |
| 489 http_server_properties_(http_server_properties), | 490 http_server_properties_(http_server_properties), |
| 490 transport_security_state_(transport_security_state), | 491 transport_security_state_(transport_security_state), |
| 491 quic_server_info_factory_(NULL), | 492 quic_server_info_factory_(NULL), |
| 492 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), | 493 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), |
| 493 random_generator_(random_generator), | 494 random_generator_(random_generator), |
| 494 clock_(clock), | 495 clock_(clock), |
| 495 max_packet_length_(max_packet_length), | 496 max_packet_length_(max_packet_length), |
| 496 config_(InitializeQuicConfig(enable_time_based_loss_detection, | 497 config_(InitializeQuicConfig(enable_time_based_loss_detection, |
| 497 connection_options)), | 498 connection_options)), |
| 498 supported_versions_(supported_versions), | 499 supported_versions_(supported_versions), |
| 499 enable_port_selection_(enable_port_selection), | 500 enable_port_selection_(enable_port_selection), |
| 500 always_require_handshake_confirmation_( | 501 always_require_handshake_confirmation_( |
| 501 always_require_handshake_confirmation), | 502 always_require_handshake_confirmation), |
| 503 disable_connection_pooling_(disable_connection_pooling), |
| 502 port_seed_(random_generator_->RandUint64()), | 504 port_seed_(random_generator_->RandUint64()), |
| 503 weak_factory_(this) { | 505 weak_factory_(this) { |
| 504 DCHECK(transport_security_state_); | 506 DCHECK(transport_security_state_); |
| 505 crypto_config_.SetDefaults(); | 507 crypto_config_.SetDefaults(); |
| 506 crypto_config_.set_user_agent_id(user_agent_id); | 508 crypto_config_.set_user_agent_id(user_agent_id); |
| 507 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); | 509 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); |
| 508 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); | 510 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); |
| 509 crypto_config_.SetProofVerifier( | 511 crypto_config_.SetProofVerifier( |
| 510 new ProofVerifierChromium(cert_verifier, transport_security_state)); | 512 new ProofVerifierChromium(cert_verifier, transport_security_state)); |
| 511 crypto_config_.SetChannelIDSource( | 513 crypto_config_.SetChannelIDSource( |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 DCHECK(HasActiveSession(server_id)); | 575 DCHECK(HasActiveSession(server_id)); |
| 574 request->set_stream(CreateIfSessionExists(server_id, net_log)); | 576 request->set_stream(CreateIfSessionExists(server_id, net_log)); |
| 575 } | 577 } |
| 576 return rv; | 578 return rv; |
| 577 } | 579 } |
| 578 | 580 |
| 579 bool QuicStreamFactory::OnResolution( | 581 bool QuicStreamFactory::OnResolution( |
| 580 const QuicServerId& server_id, | 582 const QuicServerId& server_id, |
| 581 const AddressList& address_list) { | 583 const AddressList& address_list) { |
| 582 DCHECK(!HasActiveSession(server_id)); | 584 DCHECK(!HasActiveSession(server_id)); |
| 585 if (disable_connection_pooling_) { |
| 586 return false; |
| 587 } |
| 583 for (size_t i = 0; i < address_list.size(); ++i) { | 588 for (size_t i = 0; i < address_list.size(); ++i) { |
| 584 const IPEndPoint& address = address_list[i]; | 589 const IPEndPoint& address = address_list[i]; |
| 585 const IpAliasKey ip_alias_key(address, server_id.is_https()); | 590 const IpAliasKey ip_alias_key(address, server_id.is_https()); |
| 586 if (!ContainsKey(ip_aliases_, ip_alias_key)) | 591 if (!ContainsKey(ip_aliases_, ip_alias_key)) |
| 587 continue; | 592 continue; |
| 588 | 593 |
| 589 const SessionSet& sessions = ip_aliases_[ip_alias_key]; | 594 const SessionSet& sessions = ip_aliases_[ip_alias_key]; |
| 590 for (SessionSet::const_iterator i = sessions.begin(); | 595 for (SessionSet::const_iterator i = sessions.begin(); |
| 591 i != sessions.end(); ++i) { | 596 i != sessions.end(); ++i) { |
| 592 QuicClientSession* session = *i; | 597 QuicClientSession* session = *i; |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 http_server_properties_->ClearAlternateProtocol(server); | 985 http_server_properties_->ClearAlternateProtocol(server); |
| 981 http_server_properties_->SetAlternateProtocol( | 986 http_server_properties_->SetAlternateProtocol( |
| 982 server, alternate.port, alternate.protocol, 1); | 987 server, alternate.port, alternate.protocol, 1); |
| 983 DCHECK_EQ(QUIC, | 988 DCHECK_EQ(QUIC, |
| 984 http_server_properties_->GetAlternateProtocol(server).protocol); | 989 http_server_properties_->GetAlternateProtocol(server).protocol); |
| 985 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 990 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
| 986 server)); | 991 server)); |
| 987 } | 992 } |
| 988 | 993 |
| 989 } // namespace net | 994 } // namespace net |
| OLD | NEW |