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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 for (AliasSet::const_iterator alias_it = aliases.begin(); | 641 for (AliasSet::const_iterator alias_it = aliases.begin(); |
642 alias_it != aliases.end(); ++alias_it) { | 642 alias_it != aliases.end(); ++alias_it) { |
643 hosts.insert(alias_it->host_port_pair()); | 643 hosts.insert(alias_it->host_port_pair()); |
644 } | 644 } |
645 list->Append(session->GetInfoAsValue(hosts)); | 645 list->Append(session->GetInfoAsValue(hosts)); |
646 } | 646 } |
647 } | 647 } |
648 return list; | 648 return list; |
649 } | 649 } |
650 | 650 |
651 void QuicStreamFactory::ClearCachedStates() { | 651 void QuicStreamFactory::ClearCachedStatesInCryptoConfig() { |
652 crypto_config_.ClearCachedStates(); | 652 crypto_config_.ClearCachedStates(); |
653 } | 653 } |
654 | 654 |
655 void QuicStreamFactory::OnIPAddressChanged() { | 655 void QuicStreamFactory::OnIPAddressChanged() { |
656 CloseAllSessions(ERR_NETWORK_CHANGED); | 656 CloseAllSessions(ERR_NETWORK_CHANGED); |
657 require_confirmation_ = true; | 657 require_confirmation_ = true; |
658 } | 658 } |
659 | 659 |
660 void QuicStreamFactory::OnCertAdded(const X509Certificate* cert) { | 660 void QuicStreamFactory::OnCertAdded(const X509Certificate* cert) { |
661 CloseAllSessions(ERR_CERT_DATABASE_CHANGED); | 661 CloseAllSessions(ERR_CERT_DATABASE_CHANGED); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 base::MessageLoop::current()->message_loop_proxy().get(), | 747 base::MessageLoop::current()->message_loop_proxy().get(), |
748 clock_.get(), random_generator_)); | 748 clock_.get(), random_generator_)); |
749 } | 749 } |
750 | 750 |
751 QuicConnection* connection = | 751 QuicConnection* connection = |
752 new QuicConnection(connection_id, addr, helper_.get(), writer.get(), | 752 new QuicConnection(connection_id, addr, helper_.get(), writer.get(), |
753 false, supported_versions_, kInitialReceiveWindowSize); | 753 false, supported_versions_, kInitialReceiveWindowSize); |
754 writer->SetConnection(connection); | 754 writer->SetConnection(connection); |
755 connection->options()->max_packet_length = max_packet_length_; | 755 connection->options()->max_packet_length = max_packet_length_; |
756 | 756 |
757 InitializeCachedState(server_id, server_info); | 757 InitializeCachedStateInCryptoConfig(server_id, server_info); |
758 | 758 |
759 QuicConfig config = config_; | 759 QuicConfig config = config_; |
760 if (http_server_properties_) { | 760 if (http_server_properties_) { |
761 const HttpServerProperties::NetworkStats* stats = | 761 const HttpServerProperties::NetworkStats* stats = |
762 http_server_properties_->GetServerNetworkStats( | 762 http_server_properties_->GetServerNetworkStats( |
763 server_id.host_port_pair()); | 763 server_id.host_port_pair()); |
764 if (stats != NULL) { | 764 if (stats != NULL) { |
765 config.SetInitialRoundTripTimeUsToSend(stats->srtt.InMicroseconds()); | 765 config.SetInitialRoundTripTimeUsToSend(stats->srtt.InMicroseconds()); |
766 } | 766 } |
767 } | 767 } |
(...skipping 15 matching lines...) Expand all Loading... |
783 QuicClientSession* session) { | 783 QuicClientSession* session) { |
784 DCHECK(!HasActiveSession(server_id)); | 784 DCHECK(!HasActiveSession(server_id)); |
785 active_sessions_[server_id] = session; | 785 active_sessions_[server_id] = session; |
786 session_aliases_[session].insert(server_id); | 786 session_aliases_[session].insert(server_id); |
787 const IpAliasKey ip_alias_key(session->connection()->peer_address(), | 787 const IpAliasKey ip_alias_key(session->connection()->peer_address(), |
788 server_id.is_https()); | 788 server_id.is_https()); |
789 DCHECK(!ContainsKey(ip_aliases_[ip_alias_key], session)); | 789 DCHECK(!ContainsKey(ip_aliases_[ip_alias_key], session)); |
790 ip_aliases_[ip_alias_key].insert(session); | 790 ip_aliases_[ip_alias_key].insert(session); |
791 } | 791 } |
792 | 792 |
793 void QuicStreamFactory::InitializeCachedState( | 793 void QuicStreamFactory::InitializeCachedStateInCryptoConfig( |
794 const QuicServerId& server_id, | 794 const QuicServerId& server_id, |
795 const scoped_ptr<QuicServerInfo>& server_info) { | 795 const scoped_ptr<QuicServerInfo>& server_info) { |
796 if (!server_info) | 796 if (!server_info) |
797 return; | 797 return; |
798 | 798 |
799 QuicCryptoClientConfig::CachedState* cached = | 799 QuicCryptoClientConfig::CachedState* cached = |
800 crypto_config_.LookupOrCreate(server_id); | 800 crypto_config_.LookupOrCreate(server_id); |
801 if (!cached->IsEmpty()) | 801 if (!cached->IsEmpty()) |
802 return; | 802 return; |
803 | 803 |
804 if (!cached->Initialize(server_info->state().server_config, | 804 if (!cached->Initialize(server_info->state().server_config, |
805 server_info->state().source_address_token, | 805 server_info->state().source_address_token, |
806 server_info->state().certs, | 806 server_info->state().certs, |
807 server_info->state().server_config_sig, | 807 server_info->state().server_config_sig, |
808 clock_->WallNow())) | 808 clock_->WallNow())) |
809 return; | 809 return; |
810 | 810 |
811 if (!server_id.is_https()) { | 811 if (!server_id.is_https()) { |
812 // Don't check the certificates for insecure QUIC. | 812 // Don't check the certificates for insecure QUIC. |
813 cached->SetProofValid(); | 813 cached->SetProofValid(); |
814 } | 814 } |
815 } | 815 } |
816 | 816 |
817 } // namespace net | 817 } // namespace net |
OLD | NEW |