Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(683)

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

Issue 2789093003: Mark QUIC broken when the network blackholes after the handshake (Closed)
Patch Set: jana's comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/chromium/quic_stream_factory.h ('k') | net/quic/chromium/quic_stream_factory_peer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "net/quic/chromium/quic_stream_factory.h" 5 #include "net/quic/chromium/quic_stream_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <tuple> 8 #include <tuple>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 bool disable_connection_pooling, 717 bool disable_connection_pooling,
718 float load_server_info_timeout_srtt_multiplier, 718 float load_server_info_timeout_srtt_multiplier,
719 bool enable_connection_racing, 719 bool enable_connection_racing,
720 bool enable_non_blocking_io, 720 bool enable_non_blocking_io,
721 bool disable_disk_cache, 721 bool disable_disk_cache,
722 bool prefer_aes, 722 bool prefer_aes,
723 int socket_receive_buffer_size, 723 int socket_receive_buffer_size,
724 bool delay_tcp_race, 724 bool delay_tcp_race,
725 int max_server_configs_stored_in_properties, 725 int max_server_configs_stored_in_properties,
726 bool close_sessions_on_ip_change, 726 bool close_sessions_on_ip_change,
727 bool mark_quic_broken_when_network_blackholes,
727 int idle_connection_timeout_seconds, 728 int idle_connection_timeout_seconds,
728 int reduced_ping_timeout_seconds, 729 int reduced_ping_timeout_seconds,
729 int packet_reader_yield_after_duration_milliseconds, 730 int packet_reader_yield_after_duration_milliseconds,
730 bool migrate_sessions_on_network_change, 731 bool migrate_sessions_on_network_change,
731 bool migrate_sessions_early, 732 bool migrate_sessions_early,
732 bool allow_server_migration, 733 bool allow_server_migration,
733 bool force_hol_blocking, 734 bool force_hol_blocking,
734 bool race_cert_verification, 735 bool race_cert_verification,
735 bool do_not_fragment, 736 bool do_not_fragment,
736 bool estimate_initial_rtt, 737 bool estimate_initial_rtt,
(...skipping 24 matching lines...) Expand all
761 supported_versions_(supported_versions), 762 supported_versions_(supported_versions),
762 always_require_handshake_confirmation_( 763 always_require_handshake_confirmation_(
763 always_require_handshake_confirmation), 764 always_require_handshake_confirmation),
764 disable_connection_pooling_(disable_connection_pooling), 765 disable_connection_pooling_(disable_connection_pooling),
765 load_server_info_timeout_srtt_multiplier_( 766 load_server_info_timeout_srtt_multiplier_(
766 load_server_info_timeout_srtt_multiplier), 767 load_server_info_timeout_srtt_multiplier),
767 enable_connection_racing_(enable_connection_racing), 768 enable_connection_racing_(enable_connection_racing),
768 enable_non_blocking_io_(enable_non_blocking_io), 769 enable_non_blocking_io_(enable_non_blocking_io),
769 disable_disk_cache_(disable_disk_cache), 770 disable_disk_cache_(disable_disk_cache),
770 prefer_aes_(prefer_aes), 771 prefer_aes_(prefer_aes),
772 mark_quic_broken_when_network_blackholes_(
773 mark_quic_broken_when_network_blackholes),
771 socket_receive_buffer_size_(socket_receive_buffer_size), 774 socket_receive_buffer_size_(socket_receive_buffer_size),
772 delay_tcp_race_(delay_tcp_race), 775 delay_tcp_race_(delay_tcp_race),
773 ping_timeout_(QuicTime::Delta::FromSeconds(kPingTimeoutSecs)), 776 ping_timeout_(QuicTime::Delta::FromSeconds(kPingTimeoutSecs)),
774 reduced_ping_timeout_( 777 reduced_ping_timeout_(
775 QuicTime::Delta::FromSeconds(reduced_ping_timeout_seconds)), 778 QuicTime::Delta::FromSeconds(reduced_ping_timeout_seconds)),
776 yield_after_packets_(kQuicYieldAfterPacketsRead), 779 yield_after_packets_(kQuicYieldAfterPacketsRead),
777 yield_after_duration_(QuicTime::Delta::FromMilliseconds( 780 yield_after_duration_(QuicTime::Delta::FromMilliseconds(
778 packet_reader_yield_after_duration_milliseconds)), 781 packet_reader_yield_after_duration_milliseconds)),
779 close_sessions_on_ip_change_(close_sessions_on_ip_change), 782 close_sessions_on_ip_change_(close_sessions_on_ip_change),
780 migrate_sessions_on_network_change_( 783 migrate_sessions_on_network_change_(
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 active_jobs_.erase(server_id); 1148 active_jobs_.erase(server_id);
1146 job_requests_map_.erase(requests_iter); 1149 job_requests_map_.erase(requests_iter);
1147 } 1150 }
1148 1151
1149 void QuicStreamFactory::OnCertVerifyJobComplete(CertVerifierJob* job, int rv) { 1152 void QuicStreamFactory::OnCertVerifyJobComplete(CertVerifierJob* job, int rv) {
1150 active_cert_verifier_jobs_.erase(job->server_id()); 1153 active_cert_verifier_jobs_.erase(job->server_id());
1151 } 1154 }
1152 1155
1153 std::unique_ptr<QuicHttpStream> QuicStreamFactory::CreateFromSession( 1156 std::unique_ptr<QuicHttpStream> QuicStreamFactory::CreateFromSession(
1154 QuicChromiumClientSession* session) { 1157 QuicChromiumClientSession* session) {
1155 return std::unique_ptr<QuicHttpStream>( 1158 return base::MakeUnique<QuicHttpStream>(session->GetWeakPtr(),
1156 new QuicHttpStream(session->GetWeakPtr(), http_server_properties_)); 1159 http_server_properties_);
1157 } 1160 }
1158 1161
1159 void QuicStreamFactory::OnIdleSession(QuicChromiumClientSession* session) {} 1162 void QuicStreamFactory::OnIdleSession(QuicChromiumClientSession* session) {}
1160 1163
1161 void QuicStreamFactory::OnSessionGoingAway(QuicChromiumClientSession* session) { 1164 void QuicStreamFactory::OnSessionGoingAway(QuicChromiumClientSession* session) {
1162 const AliasSet& aliases = session_aliases_[session]; 1165 const AliasSet& aliases = session_aliases_[session];
1163 for (AliasSet::const_iterator it = aliases.begin(); it != aliases.end(); 1166 for (AliasSet::const_iterator it = aliases.begin(); it != aliases.end();
1164 ++it) { 1167 ++it) {
1165 const QuicServerId& server_id = it->server_id(); 1168 const QuicServerId& server_id = it->server_id();
1166 DCHECK(active_sessions_.count(server_id)); 1169 DCHECK(active_sessions_.count(server_id));
(...skipping 18 matching lines...) Expand all
1185 session_aliases_.erase(session); 1188 session_aliases_.erase(session);
1186 } 1189 }
1187 1190
1188 void QuicStreamFactory::OnSessionClosed(QuicChromiumClientSession* session) { 1191 void QuicStreamFactory::OnSessionClosed(QuicChromiumClientSession* session) {
1189 DCHECK_EQ(0u, session->GetNumActiveStreams()); 1192 DCHECK_EQ(0u, session->GetNumActiveStreams());
1190 OnSessionGoingAway(session); 1193 OnSessionGoingAway(session);
1191 delete session; 1194 delete session;
1192 all_sessions_.erase(session); 1195 all_sessions_.erase(session);
1193 } 1196 }
1194 1197
1195 void QuicStreamFactory::OnTimeoutWithOpenStreams() { 1198 void QuicStreamFactory::OnBlackholeAfterHandshakeConfirmed(
1196 // Reduce PING timeout when connection times out with open stream. 1199 QuicChromiumClientSession* session) {
1197 if (ping_timeout_ > reduced_ping_timeout_) { 1200 // Reduce PING timeout when connection blackholes after the handshake.
1201 if (ping_timeout_ > reduced_ping_timeout_)
1198 ping_timeout_ = reduced_ping_timeout_; 1202 ping_timeout_ = reduced_ping_timeout_;
1203
1204 if (mark_quic_broken_when_network_blackholes_) {
1205 http_server_properties_->MarkAlternativeServiceBroken(
1206 AlternativeService(kProtoQUIC, session->server_id().host_port_pair()));
1199 } 1207 }
1200 } 1208 }
1201 1209
1202 void QuicStreamFactory::CancelRequest(QuicStreamRequest* request) { 1210 void QuicStreamFactory::CancelRequest(QuicStreamRequest* request) {
1203 ServerIDRequestsMap::iterator requests_it = 1211 ServerIDRequestsMap::iterator requests_it =
1204 job_requests_map_.find(request->server_id()); 1212 job_requests_map_.find(request->server_id());
1205 DCHECK(requests_it != job_requests_map_.end()); 1213 DCHECK(requests_it != job_requests_map_.end());
1206 requests_it->second.erase(request); 1214 requests_it->second.erase(request);
1207 } 1215 }
1208 1216
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
1851 const QuicServerId& server_id, 1859 const QuicServerId& server_id,
1852 bool session_was_active) { 1860 bool session_was_active) {
1853 if (!http_server_properties_) 1861 if (!http_server_properties_)
1854 return; 1862 return;
1855 1863
1856 const QuicConnectionStats& stats = session->connection()->GetStats(); 1864 const QuicConnectionStats& stats = session->connection()->GetStats();
1857 const AlternativeService alternative_service(kProtoQUIC, 1865 const AlternativeService alternative_service(kProtoQUIC,
1858 server_id.host_port_pair()); 1866 server_id.host_port_pair());
1859 url::SchemeHostPort server("https", server_id.host_port_pair().host(), 1867 url::SchemeHostPort server("https", server_id.host_port_pair().host(),
1860 server_id.host_port_pair().port()); 1868 server_id.host_port_pair().port());
1869 // Do nothing if QUIC is currently marked as broken.
1870 if (http_server_properties_->IsAlternativeServiceBroken(alternative_service))
1871 return;
1872
1861 if (session->IsCryptoHandshakeConfirmed()) { 1873 if (session->IsCryptoHandshakeConfirmed()) {
1862 http_server_properties_->ConfirmAlternativeService(alternative_service); 1874 http_server_properties_->ConfirmAlternativeService(alternative_service);
1863 ServerNetworkStats network_stats; 1875 ServerNetworkStats network_stats;
1864 network_stats.srtt = base::TimeDelta::FromMicroseconds(stats.srtt_us); 1876 network_stats.srtt = base::TimeDelta::FromMicroseconds(stats.srtt_us);
1865 network_stats.bandwidth_estimate = stats.estimated_bandwidth; 1877 network_stats.bandwidth_estimate = stats.estimated_bandwidth;
1866 http_server_properties_->SetServerNetworkStats(server, network_stats); 1878 http_server_properties_->SetServerNetworkStats(server, network_stats);
1867 return; 1879 return;
1868 } 1880 }
1869 1881
1870 http_server_properties_->ClearServerNetworkStats(server); 1882 http_server_properties_->ClearServerNetworkStats(server);
(...skipping 14 matching lines...) Expand all
1885 // Since the session was active, there's no longer an 1897 // Since the session was active, there's no longer an
1886 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP 1898 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP
1887 // job also fails. So to avoid not using QUIC when we otherwise could, we mark 1899 // job also fails. So to avoid not using QUIC when we otherwise could, we mark
1888 // it as recently broken, which means that 0-RTT will be disabled but we'll 1900 // it as recently broken, which means that 0-RTT will be disabled but we'll
1889 // still race. 1901 // still race.
1890 http_server_properties_->MarkAlternativeServiceRecentlyBroken( 1902 http_server_properties_->MarkAlternativeServiceRecentlyBroken(
1891 alternative_service); 1903 alternative_service);
1892 } 1904 }
1893 1905
1894 } // namespace net 1906 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/chromium/quic_stream_factory.h ('k') | net/quic/chromium/quic_stream_factory_peer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698