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/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 host_port_proxy_pair.first); | 612 host_port_proxy_pair.first); |
613 if (stats != NULL) { | 613 if (stats != NULL) { |
614 config.set_initial_round_trip_time_us(stats->rtt.InMicroseconds(), | 614 config.set_initial_round_trip_time_us(stats->rtt.InMicroseconds(), |
615 stats->rtt.InMicroseconds()); | 615 stats->rtt.InMicroseconds()); |
616 } | 616 } |
617 } | 617 } |
618 | 618 |
619 *session = new QuicClientSession( | 619 *session = new QuicClientSession( |
620 connection, socket.Pass(), writer.Pass(), this, | 620 connection, socket.Pass(), writer.Pass(), this, |
621 quic_crypto_client_stream_factory_, host_port_proxy_pair.first.host(), | 621 quic_crypto_client_stream_factory_, host_port_proxy_pair.first.host(), |
622 config, crypto_config, net_log.net_log()); | 622 host_port_proxy_pair.first.port(), config, crypto_config, |
| 623 net_log.net_log()); |
623 all_sessions_.insert(*session); // owning pointer | 624 all_sessions_.insert(*session); // owning pointer |
624 if (is_https) { | 625 if (is_https) { |
625 crypto_config->SetProofVerifier( | 626 crypto_config->SetProofVerifier( |
626 new ProofVerifierChromium(cert_verifier, net_log)); | 627 new ProofVerifierChromium(cert_verifier, net_log)); |
627 } | 628 } |
628 return OK; | 629 return OK; |
629 } | 630 } |
630 | 631 |
631 bool QuicStreamFactory::HasActiveJob( | 632 bool QuicStreamFactory::HasActiveJob( |
632 const HostPortProxyPair& host_port_proxy_pair) { | 633 const HostPortProxyPair& host_port_proxy_pair) { |
(...skipping 18 matching lines...) Expand all Loading... |
651 if (ContainsKey(all_crypto_configs_, host_port_proxy_pair)) { | 652 if (ContainsKey(all_crypto_configs_, host_port_proxy_pair)) { |
652 crypto_config = all_crypto_configs_[host_port_proxy_pair]; | 653 crypto_config = all_crypto_configs_[host_port_proxy_pair]; |
653 DCHECK(crypto_config); | 654 DCHECK(crypto_config); |
654 } else { | 655 } else { |
655 // TODO(rtenneti): if two quic_sessions for the same host_port_proxy_pair | 656 // TODO(rtenneti): if two quic_sessions for the same host_port_proxy_pair |
656 // share the same crypto_config, will it cause issues? | 657 // share the same crypto_config, will it cause issues? |
657 crypto_config = new QuicCryptoClientConfig(); | 658 crypto_config = new QuicCryptoClientConfig(); |
658 if (quic_server_info_factory_) { | 659 if (quic_server_info_factory_) { |
659 QuicCryptoClientConfig::CachedState* cached = | 660 QuicCryptoClientConfig::CachedState* cached = |
660 crypto_config->Create(host_port_proxy_pair.first.host(), | 661 crypto_config->Create(host_port_proxy_pair.first.host(), |
| 662 host_port_proxy_pair.first.port(), |
661 quic_server_info_factory_); | 663 quic_server_info_factory_); |
662 DCHECK(cached); | 664 DCHECK(cached); |
663 } | 665 } |
664 crypto_config->SetDefaults(); | 666 crypto_config->SetDefaults(); |
665 all_crypto_configs_[host_port_proxy_pair] = crypto_config; | 667 all_crypto_configs_[host_port_proxy_pair] = crypto_config; |
666 PopulateFromCanonicalConfig(host_port_proxy_pair, crypto_config); | 668 PopulateFromCanonicalConfig(host_port_proxy_pair, crypto_config); |
667 } | 669 } |
668 return crypto_config; | 670 return crypto_config; |
669 } | 671 } |
670 | 672 |
(...skipping 23 matching lines...) Expand all Loading... |
694 | 696 |
695 const HostPortProxyPair& canonical_host_port_proxy_pair = | 697 const HostPortProxyPair& canonical_host_port_proxy_pair = |
696 canonical_hostname_to_origin_map_[canonical_host_port]; | 698 canonical_hostname_to_origin_map_[canonical_host_port]; |
697 QuicCryptoClientConfig* canonical_crypto_config = | 699 QuicCryptoClientConfig* canonical_crypto_config = |
698 all_crypto_configs_[canonical_host_port_proxy_pair]; | 700 all_crypto_configs_[canonical_host_port_proxy_pair]; |
699 DCHECK(canonical_crypto_config); | 701 DCHECK(canonical_crypto_config); |
700 | 702 |
701 // Copy the CachedState for the canonical server from canonical_crypto_config | 703 // Copy the CachedState for the canonical server from canonical_crypto_config |
702 // as the initial CachedState for the server_hostname in crypto_config. | 704 // as the initial CachedState for the server_hostname in crypto_config. |
703 crypto_config->InitializeFrom(server_hostname, | 705 crypto_config->InitializeFrom(server_hostname, |
| 706 host_port_proxy_pair.first.port(), |
704 canonical_host_port_proxy_pair.first.host(), | 707 canonical_host_port_proxy_pair.first.host(), |
| 708 canonical_host_port_proxy_pair.first.port(), |
705 canonical_crypto_config); | 709 canonical_crypto_config); |
706 // Update canonical version to point at the "most recent" crypto_config. | 710 // Update canonical version to point at the "most recent" crypto_config. |
707 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair; | 711 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair; |
708 } | 712 } |
709 | 713 |
710 } // namespace net | 714 } // namespace net |
OLD | NEW |