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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 367 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
368 "422516 QuicStreamFactory::Job::DoLoadServerInfo")); | 368 "422516 QuicStreamFactory::Job::DoLoadServerInfo")); |
369 | 369 |
370 io_state_ = STATE_LOAD_SERVER_INFO_COMPLETE; | 370 io_state_ = STATE_LOAD_SERVER_INFO_COMPLETE; |
371 | 371 |
372 if (!server_info_) | 372 if (!server_info_) |
373 return OK; | 373 return OK; |
374 | 374 |
375 // To mitigate the effects of disk cache taking too long to load QUIC server | 375 // To mitigate the effects of disk cache taking too long to load QUIC server |
376 // information, set up a timer to cancel WaitForDataReady's callback. | 376 // information, set up a timer to cancel WaitForDataReady's callback. |
377 if (factory_->load_server_info_timeout_ms_ > 0) { | 377 int64 load_server_info_timeout_ms = factory_->load_server_info_timeout_ms_; |
| 378 if (factory_->load_server_info_timeout_srtt_multiplier_ > 0) { |
| 379 DCHECK_EQ(0, load_server_info_timeout_ms); |
| 380 load_server_info_timeout_ms = |
| 381 (factory_->load_server_info_timeout_srtt_multiplier_ * |
| 382 factory_->GetServerNetworkStatsSmoothedRttInMicroseconds(server_id_)) / |
| 383 1000; |
| 384 } |
| 385 if (load_server_info_timeout_ms > 0) { |
378 factory_->task_runner_->PostDelayedTask( | 386 factory_->task_runner_->PostDelayedTask( |
379 FROM_HERE, | 387 FROM_HERE, |
380 base::Bind(&QuicStreamFactory::Job::CancelWaitForDataReadyCallback, | 388 base::Bind(&QuicStreamFactory::Job::CancelWaitForDataReadyCallback, |
381 weak_factory_.GetWeakPtr()), | 389 weak_factory_.GetWeakPtr()), |
382 base::TimeDelta::FromMilliseconds( | 390 base::TimeDelta::FromMilliseconds(load_server_info_timeout_ms)); |
383 factory_->load_server_info_timeout_ms_)); | |
384 } | 391 } |
385 | 392 |
386 disk_cache_load_start_time_ = base::TimeTicks::Now(); | 393 disk_cache_load_start_time_ = base::TimeTicks::Now(); |
387 return server_info_->WaitForDataReady( | 394 return server_info_->WaitForDataReady( |
388 base::Bind(&QuicStreamFactory::Job::OnIOComplete, | 395 base::Bind(&QuicStreamFactory::Job::OnIOComplete, |
389 weak_factory_.GetWeakPtr())); | 396 weak_factory_.GetWeakPtr())); |
390 } | 397 } |
391 | 398 |
392 int QuicStreamFactory::Job::DoLoadServerInfoComplete(int rv) { | 399 int QuicStreamFactory::Job::DoLoadServerInfoComplete(int rv) { |
393 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. | 400 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
(...skipping 27 matching lines...) Expand all Loading... |
421 if (rv != OK) { | 428 if (rv != OK) { |
422 DCHECK(rv != ERR_IO_PENDING); | 429 DCHECK(rv != ERR_IO_PENDING); |
423 DCHECK(!session_); | 430 DCHECK(!session_); |
424 return rv; | 431 return rv; |
425 } | 432 } |
426 | 433 |
427 if (!session_->connection()->connected()) { | 434 if (!session_->connection()->connected()) { |
428 return ERR_CONNECTION_CLOSED; | 435 return ERR_CONNECTION_CLOSED; |
429 } | 436 } |
430 | 437 |
| 438 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 439 tracked_objects::ScopedTracker tracking_profile1( |
| 440 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 441 "422516 QuicStreamFactory::Job::DoConnect1")); |
| 442 |
431 session_->StartReading(); | 443 session_->StartReading(); |
432 if (!session_->connection()->connected()) { | 444 if (!session_->connection()->connected()) { |
433 return ERR_QUIC_PROTOCOL_ERROR; | 445 return ERR_QUIC_PROTOCOL_ERROR; |
434 } | 446 } |
435 bool require_confirmation = | 447 bool require_confirmation = |
436 factory_->require_confirmation() || is_post_ || | 448 factory_->require_confirmation() || is_post_ || |
437 was_alternate_protocol_recently_broken_; | 449 was_alternate_protocol_recently_broken_; |
| 450 |
| 451 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 452 tracked_objects::ScopedTracker tracking_profile2( |
| 453 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 454 "422516 QuicStreamFactory::Job::DoConnect2")); |
| 455 |
438 rv = session_->CryptoConnect( | 456 rv = session_->CryptoConnect( |
439 require_confirmation, | 457 require_confirmation, |
440 base::Bind(&QuicStreamFactory::Job::OnIOComplete, | 458 base::Bind(&QuicStreamFactory::Job::OnIOComplete, |
441 base::Unretained(this))); | 459 base::Unretained(this))); |
442 return rv; | 460 return rv; |
443 } | 461 } |
444 | 462 |
445 int QuicStreamFactory::Job::DoResumeConnect() { | 463 int QuicStreamFactory::Job::DoResumeConnect() { |
446 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. | 464 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
447 tracked_objects::ScopedTracker tracking_profile( | 465 tracked_objects::ScopedTracker tracking_profile( |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 QuicRandom* random_generator, | 557 QuicRandom* random_generator, |
540 QuicClock* clock, | 558 QuicClock* clock, |
541 size_t max_packet_length, | 559 size_t max_packet_length, |
542 const std::string& user_agent_id, | 560 const std::string& user_agent_id, |
543 const QuicVersionVector& supported_versions, | 561 const QuicVersionVector& supported_versions, |
544 bool enable_port_selection, | 562 bool enable_port_selection, |
545 bool always_require_handshake_confirmation, | 563 bool always_require_handshake_confirmation, |
546 bool disable_connection_pooling, | 564 bool disable_connection_pooling, |
547 int load_server_info_timeout, | 565 int load_server_info_timeout, |
548 bool disable_loading_server_info_for_new_servers, | 566 bool disable_loading_server_info_for_new_servers, |
| 567 float load_server_info_timeout_srtt_multiplier, |
549 const QuicTagVector& connection_options) | 568 const QuicTagVector& connection_options) |
550 : require_confirmation_(true), | 569 : require_confirmation_(true), |
551 host_resolver_(host_resolver), | 570 host_resolver_(host_resolver), |
552 client_socket_factory_(client_socket_factory), | 571 client_socket_factory_(client_socket_factory), |
553 http_server_properties_(http_server_properties), | 572 http_server_properties_(http_server_properties), |
554 transport_security_state_(transport_security_state), | 573 transport_security_state_(transport_security_state), |
555 quic_server_info_factory_(nullptr), | 574 quic_server_info_factory_(nullptr), |
556 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), | 575 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), |
557 random_generator_(random_generator), | 576 random_generator_(random_generator), |
558 clock_(clock), | 577 clock_(clock), |
559 max_packet_length_(max_packet_length), | 578 max_packet_length_(max_packet_length), |
560 config_(InitializeQuicConfig(connection_options)), | 579 config_(InitializeQuicConfig(connection_options)), |
561 supported_versions_(supported_versions), | 580 supported_versions_(supported_versions), |
562 enable_port_selection_(enable_port_selection), | 581 enable_port_selection_(enable_port_selection), |
563 always_require_handshake_confirmation_( | 582 always_require_handshake_confirmation_( |
564 always_require_handshake_confirmation), | 583 always_require_handshake_confirmation), |
565 disable_connection_pooling_(disable_connection_pooling), | 584 disable_connection_pooling_(disable_connection_pooling), |
566 load_server_info_timeout_ms_(load_server_info_timeout), | 585 load_server_info_timeout_ms_(load_server_info_timeout), |
567 disable_loading_server_info_for_new_servers_( | 586 disable_loading_server_info_for_new_servers_( |
568 disable_loading_server_info_for_new_servers), | 587 disable_loading_server_info_for_new_servers), |
| 588 load_server_info_timeout_srtt_multiplier_( |
| 589 load_server_info_timeout_srtt_multiplier), |
569 port_seed_(random_generator_->RandUint64()), | 590 port_seed_(random_generator_->RandUint64()), |
570 check_persisted_supports_quic_(true), | 591 check_persisted_supports_quic_(true), |
571 task_runner_(nullptr), | 592 task_runner_(nullptr), |
572 weak_factory_(this) { | 593 weak_factory_(this) { |
573 DCHECK(transport_security_state_); | 594 DCHECK(transport_security_state_); |
574 crypto_config_.set_user_agent_id(user_agent_id); | 595 crypto_config_.set_user_agent_id(user_agent_id); |
575 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); | 596 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); |
576 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); | 597 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); |
577 crypto_config_.SetProofVerifier( | 598 crypto_config_.SetProofVerifier( |
578 new ProofVerifierChromium(cert_verifier, transport_security_state)); | 599 new ProofVerifierChromium(cert_verifier, transport_security_state)); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
901 const QuicServerId& server_id) const { | 922 const QuicServerId& server_id) const { |
902 return ContainsKey(active_sessions_, server_id); | 923 return ContainsKey(active_sessions_, server_id); |
903 } | 924 } |
904 | 925 |
905 int QuicStreamFactory::CreateSession( | 926 int QuicStreamFactory::CreateSession( |
906 const QuicServerId& server_id, | 927 const QuicServerId& server_id, |
907 scoped_ptr<QuicServerInfo> server_info, | 928 scoped_ptr<QuicServerInfo> server_info, |
908 const AddressList& address_list, | 929 const AddressList& address_list, |
909 const BoundNetLog& net_log, | 930 const BoundNetLog& net_log, |
910 QuicClientSession** session) { | 931 QuicClientSession** session) { |
| 932 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 933 tracked_objects::ScopedTracker tracking_profile1( |
| 934 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 935 "422516 QuicStreamFactory::CreateSession1")); |
| 936 |
911 bool enable_port_selection = enable_port_selection_; | 937 bool enable_port_selection = enable_port_selection_; |
912 if (enable_port_selection && | 938 if (enable_port_selection && |
913 ContainsKey(gone_away_aliases_, server_id)) { | 939 ContainsKey(gone_away_aliases_, server_id)) { |
914 // Disable port selection when the server is going away. | 940 // Disable port selection when the server is going away. |
915 // There is no point in trying to return to the same server, if | 941 // There is no point in trying to return to the same server, if |
916 // that server is no longer handling requests. | 942 // that server is no longer handling requests. |
917 enable_port_selection = false; | 943 enable_port_selection = false; |
918 gone_away_aliases_.erase(server_id); | 944 gone_away_aliases_.erase(server_id); |
919 } | 945 } |
920 | 946 |
921 QuicConnectionId connection_id = random_generator_->RandUint64(); | 947 QuicConnectionId connection_id = random_generator_->RandUint64(); |
922 IPEndPoint addr = *address_list.begin(); | 948 IPEndPoint addr = *address_list.begin(); |
923 scoped_refptr<PortSuggester> port_suggester = | 949 scoped_refptr<PortSuggester> port_suggester = |
924 new PortSuggester(server_id.host_port_pair(), port_seed_); | 950 new PortSuggester(server_id.host_port_pair(), port_seed_); |
925 DatagramSocket::BindType bind_type = enable_port_selection ? | 951 DatagramSocket::BindType bind_type = enable_port_selection ? |
926 DatagramSocket::RANDOM_BIND : // Use our callback. | 952 DatagramSocket::RANDOM_BIND : // Use our callback. |
927 DatagramSocket::DEFAULT_BIND; // Use OS to randomize. | 953 DatagramSocket::DEFAULT_BIND; // Use OS to randomize. |
928 scoped_ptr<DatagramClientSocket> socket( | 954 scoped_ptr<DatagramClientSocket> socket( |
929 client_socket_factory_->CreateDatagramClientSocket( | 955 client_socket_factory_->CreateDatagramClientSocket( |
930 bind_type, | 956 bind_type, |
931 base::Bind(&PortSuggester::SuggestPort, port_suggester), | 957 base::Bind(&PortSuggester::SuggestPort, port_suggester), |
932 net_log.net_log(), net_log.source())); | 958 net_log.net_log(), net_log.source())); |
| 959 |
| 960 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 961 tracked_objects::ScopedTracker tracking_profile2( |
| 962 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 963 "422516 QuicStreamFactory::CreateSession2")); |
| 964 |
933 int rv = socket->Connect(addr); | 965 int rv = socket->Connect(addr); |
| 966 |
| 967 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 968 tracked_objects::ScopedTracker tracking_profile3( |
| 969 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 970 "422516 QuicStreamFactory::CreateSession3")); |
| 971 |
934 if (rv != OK) { | 972 if (rv != OK) { |
935 HistogramCreateSessionFailure(CREATION_ERROR_CONNECTING_SOCKET); | 973 HistogramCreateSessionFailure(CREATION_ERROR_CONNECTING_SOCKET); |
936 return rv; | 974 return rv; |
937 } | 975 } |
938 UMA_HISTOGRAM_COUNTS("Net.QuicEphemeralPortsSuggested", | 976 UMA_HISTOGRAM_COUNTS("Net.QuicEphemeralPortsSuggested", |
939 port_suggester->call_count()); | 977 port_suggester->call_count()); |
940 if (enable_port_selection) { | 978 if (enable_port_selection) { |
941 DCHECK_LE(1u, port_suggester->call_count()); | 979 DCHECK_LE(1u, port_suggester->call_count()); |
942 } else { | 980 } else { |
943 DCHECK_EQ(0u, port_suggester->call_count()); | 981 DCHECK_EQ(0u, port_suggester->call_count()); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
976 } | 1014 } |
977 | 1015 |
978 DefaultPacketWriterFactory packet_writer_factory(socket.get()); | 1016 DefaultPacketWriterFactory packet_writer_factory(socket.get()); |
979 | 1017 |
980 if (!helper_.get()) { | 1018 if (!helper_.get()) { |
981 helper_.reset(new QuicConnectionHelper( | 1019 helper_.reset(new QuicConnectionHelper( |
982 base::MessageLoop::current()->message_loop_proxy().get(), | 1020 base::MessageLoop::current()->message_loop_proxy().get(), |
983 clock_.get(), random_generator_)); | 1021 clock_.get(), random_generator_)); |
984 } | 1022 } |
985 | 1023 |
| 1024 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 1025 tracked_objects::ScopedTracker tracking_profile4( |
| 1026 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1027 "422516 QuicStreamFactory::CreateSession4")); |
| 1028 |
986 QuicConnection* connection = new QuicConnection(connection_id, | 1029 QuicConnection* connection = new QuicConnection(connection_id, |
987 addr, | 1030 addr, |
988 helper_.get(), | 1031 helper_.get(), |
989 packet_writer_factory, | 1032 packet_writer_factory, |
990 true /* owns_writer */, | 1033 true /* owns_writer */, |
991 false /* is_server */, | 1034 false /* is_server */, |
992 server_id.is_https(), | 1035 server_id.is_https(), |
993 supported_versions_); | 1036 supported_versions_); |
994 connection->set_max_packet_length(max_packet_length_); | 1037 connection->set_max_packet_length(max_packet_length_); |
995 | 1038 |
| 1039 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 1040 tracked_objects::ScopedTracker tracking_profile5( |
| 1041 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1042 "422516 QuicStreamFactory::CreateSession5")); |
| 1043 |
996 InitializeCachedStateInCryptoConfig(server_id, server_info); | 1044 InitializeCachedStateInCryptoConfig(server_id, server_info); |
997 | 1045 |
998 QuicConfig config = config_; | 1046 QuicConfig config = config_; |
999 config.set_max_undecryptable_packets(kMaxUndecryptablePackets); | 1047 config.set_max_undecryptable_packets(kMaxUndecryptablePackets); |
1000 config.SetInitialFlowControlWindowToSend(kInitialReceiveWindowSize); | 1048 config.SetInitialFlowControlWindowToSend(kInitialReceiveWindowSize); |
1001 config.SetInitialStreamFlowControlWindowToSend(kInitialReceiveWindowSize); | 1049 config.SetInitialStreamFlowControlWindowToSend(kInitialReceiveWindowSize); |
1002 config.SetInitialSessionFlowControlWindowToSend(kInitialReceiveWindowSize); | 1050 config.SetInitialSessionFlowControlWindowToSend(kInitialReceiveWindowSize); |
1003 if (http_server_properties_) { | 1051 int64 srtt = GetServerNetworkStatsSmoothedRttInMicroseconds(server_id); |
1004 const HttpServerProperties::NetworkStats* stats = | 1052 if (srtt > 0) |
1005 http_server_properties_->GetServerNetworkStats( | 1053 config.SetInitialRoundTripTimeUsToSend(static_cast<uint32>(srtt)); |
1006 server_id.host_port_pair()); | |
1007 if (stats != nullptr) { | |
1008 config.SetInitialRoundTripTimeUsToSend( | |
1009 static_cast<uint32>(stats->srtt.InMicroseconds())); | |
1010 } | |
1011 } | |
1012 | 1054 |
1013 if (quic_server_info_factory_ && !server_info) { | 1055 if (quic_server_info_factory_ && !server_info) { |
| 1056 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 1057 tracked_objects::ScopedTracker tracking_profile6( |
| 1058 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1059 "422516 QuicStreamFactory::CreateSession6")); |
| 1060 |
1014 // Start the disk cache loading so that we can persist the newer QUIC server | 1061 // Start the disk cache loading so that we can persist the newer QUIC server |
1015 // information and/or inform the disk cache that we have reused | 1062 // information and/or inform the disk cache that we have reused |
1016 // |server_info|. | 1063 // |server_info|. |
1017 server_info.reset(quic_server_info_factory_->GetForServer(server_id)); | 1064 server_info.reset(quic_server_info_factory_->GetForServer(server_id)); |
1018 server_info->Start(); | 1065 server_info->Start(); |
1019 } | 1066 } |
1020 | 1067 |
1021 *session = new QuicClientSession( | 1068 *session = new QuicClientSession( |
1022 connection, socket.Pass(), this, transport_security_state_, | 1069 connection, socket.Pass(), this, transport_security_state_, |
1023 server_info.Pass(), config, | 1070 server_info.Pass(), config, |
1024 base::MessageLoop::current()->message_loop_proxy().get(), | 1071 base::MessageLoop::current()->message_loop_proxy().get(), |
1025 net_log.net_log()); | 1072 net_log.net_log()); |
1026 all_sessions_[*session] = server_id; // owning pointer | 1073 all_sessions_[*session] = server_id; // owning pointer |
| 1074 |
| 1075 // TODO(vadimt): Remove ScopedTracker below once crbug.com/422516 is fixed. |
| 1076 tracked_objects::ScopedTracker tracking_profile7( |
| 1077 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1078 "422516 QuicStreamFactory::CreateSession7")); |
| 1079 |
1027 (*session)->InitializeSession(server_id, &crypto_config_, | 1080 (*session)->InitializeSession(server_id, &crypto_config_, |
1028 quic_crypto_client_stream_factory_); | 1081 quic_crypto_client_stream_factory_); |
1029 bool closed_during_initialize = | 1082 bool closed_during_initialize = |
1030 !ContainsKey(all_sessions_, *session) || | 1083 !ContainsKey(all_sessions_, *session) || |
1031 !(*session)->connection()->connected(); | 1084 !(*session)->connection()->connected(); |
1032 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.ClosedDuringInitializeSession", | 1085 UMA_HISTOGRAM_BOOLEAN("Net.QuicSession.ClosedDuringInitializeSession", |
1033 closed_during_initialize); | 1086 closed_during_initialize); |
1034 if (closed_during_initialize) { | 1087 if (closed_during_initialize) { |
1035 DLOG(DFATAL) << "Session closed during initialize"; | 1088 DLOG(DFATAL) << "Session closed during initialize"; |
1036 *session = nullptr; | 1089 *session = nullptr; |
(...skipping 12 matching lines...) Expand all Loading... |
1049 DCHECK(!HasActiveSession(server_id)); | 1102 DCHECK(!HasActiveSession(server_id)); |
1050 UMA_HISTOGRAM_COUNTS("Net.QuicActiveSessions", active_sessions_.size()); | 1103 UMA_HISTOGRAM_COUNTS("Net.QuicActiveSessions", active_sessions_.size()); |
1051 active_sessions_[server_id] = session; | 1104 active_sessions_[server_id] = session; |
1052 session_aliases_[session].insert(server_id); | 1105 session_aliases_[session].insert(server_id); |
1053 const IpAliasKey ip_alias_key(session->connection()->peer_address(), | 1106 const IpAliasKey ip_alias_key(session->connection()->peer_address(), |
1054 server_id.is_https()); | 1107 server_id.is_https()); |
1055 DCHECK(!ContainsKey(ip_aliases_[ip_alias_key], session)); | 1108 DCHECK(!ContainsKey(ip_aliases_[ip_alias_key], session)); |
1056 ip_aliases_[ip_alias_key].insert(session); | 1109 ip_aliases_[ip_alias_key].insert(session); |
1057 } | 1110 } |
1058 | 1111 |
| 1112 int64 QuicStreamFactory::GetServerNetworkStatsSmoothedRttInMicroseconds( |
| 1113 const QuicServerId& server_id) const { |
| 1114 if (!http_server_properties_) |
| 1115 return 0; |
| 1116 const ServerNetworkStats* stats = |
| 1117 http_server_properties_->GetServerNetworkStats( |
| 1118 server_id.host_port_pair()); |
| 1119 if (stats == nullptr) |
| 1120 return 0; |
| 1121 return stats->srtt.InMicroseconds(); |
| 1122 } |
| 1123 |
1059 void QuicStreamFactory::InitializeCachedStateInCryptoConfig( | 1124 void QuicStreamFactory::InitializeCachedStateInCryptoConfig( |
1060 const QuicServerId& server_id, | 1125 const QuicServerId& server_id, |
1061 const scoped_ptr<QuicServerInfo>& server_info) { | 1126 const scoped_ptr<QuicServerInfo>& server_info) { |
1062 // |server_info| will be NULL, if a non-empty server config already exists in | 1127 // |server_info| will be NULL, if a non-empty server config already exists in |
1063 // the memory cache. This is a minor optimization to avoid LookupOrCreate. | 1128 // the memory cache. This is a minor optimization to avoid LookupOrCreate. |
1064 if (!server_info) | 1129 if (!server_info) |
1065 return; | 1130 return; |
1066 | 1131 |
1067 QuicCryptoClientConfig::CachedState* cached = | 1132 QuicCryptoClientConfig::CachedState* cached = |
1068 crypto_config_.LookupOrCreate(server_id); | 1133 crypto_config_.LookupOrCreate(server_id); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 | 1170 |
1106 void QuicStreamFactory::ProcessGoingAwaySession( | 1171 void QuicStreamFactory::ProcessGoingAwaySession( |
1107 QuicClientSession* session, | 1172 QuicClientSession* session, |
1108 const QuicServerId& server_id, | 1173 const QuicServerId& server_id, |
1109 bool session_was_active) { | 1174 bool session_was_active) { |
1110 if (!http_server_properties_) | 1175 if (!http_server_properties_) |
1111 return; | 1176 return; |
1112 | 1177 |
1113 const QuicConnectionStats& stats = session->connection()->GetStats(); | 1178 const QuicConnectionStats& stats = session->connection()->GetStats(); |
1114 if (session->IsCryptoHandshakeConfirmed()) { | 1179 if (session->IsCryptoHandshakeConfirmed()) { |
1115 HttpServerProperties::NetworkStats network_stats; | 1180 ServerNetworkStats network_stats; |
1116 network_stats.srtt = base::TimeDelta::FromMicroseconds(stats.srtt_us); | 1181 network_stats.srtt = base::TimeDelta::FromMicroseconds(stats.srtt_us); |
1117 network_stats.bandwidth_estimate = stats.estimated_bandwidth; | 1182 network_stats.bandwidth_estimate = stats.estimated_bandwidth; |
1118 http_server_properties_->SetServerNetworkStats(server_id.host_port_pair(), | 1183 http_server_properties_->SetServerNetworkStats(server_id.host_port_pair(), |
1119 network_stats); | 1184 network_stats); |
1120 return; | 1185 return; |
1121 } | 1186 } |
1122 | 1187 |
1123 UMA_HISTOGRAM_COUNTS("Net.QuicHandshakeNotConfirmedNumPacketsReceived", | 1188 UMA_HISTOGRAM_COUNTS("Net.QuicHandshakeNotConfirmedNumPacketsReceived", |
1124 stats.packets_received); | 1189 stats.packets_received); |
1125 | 1190 |
(...skipping 26 matching lines...) Expand all Loading... |
1152 http_server_properties_->ClearAlternateProtocol(server); | 1217 http_server_properties_->ClearAlternateProtocol(server); |
1153 http_server_properties_->SetAlternateProtocol( | 1218 http_server_properties_->SetAlternateProtocol( |
1154 server, alternate.port, alternate.protocol, 1); | 1219 server, alternate.port, alternate.protocol, 1); |
1155 DCHECK_EQ(QUIC, | 1220 DCHECK_EQ(QUIC, |
1156 http_server_properties_->GetAlternateProtocol(server).protocol); | 1221 http_server_properties_->GetAlternateProtocol(server).protocol); |
1157 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( | 1222 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( |
1158 server)); | 1223 server)); |
1159 } | 1224 } |
1160 | 1225 |
1161 } // namespace net | 1226 } // namespace net |
OLD | NEW |