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/chromium/quic_stream_factory.h" | 5 #include "net/quic/chromium/quic_stream_factory.h" |
6 | 6 |
7 #include <openssl/aead.h> | 7 #include <openssl/aead.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <tuple> | 10 #include <tuple> |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 const std::string& user_agent_id, | 719 const std::string& user_agent_id, |
720 const QuicVersionVector& supported_versions, | 720 const QuicVersionVector& supported_versions, |
721 bool enable_port_selection, | 721 bool enable_port_selection, |
722 bool always_require_handshake_confirmation, | 722 bool always_require_handshake_confirmation, |
723 bool disable_connection_pooling, | 723 bool disable_connection_pooling, |
724 float load_server_info_timeout_srtt_multiplier, | 724 float load_server_info_timeout_srtt_multiplier, |
725 bool enable_connection_racing, | 725 bool enable_connection_racing, |
726 bool enable_non_blocking_io, | 726 bool enable_non_blocking_io, |
727 bool disable_disk_cache, | 727 bool disable_disk_cache, |
728 bool prefer_aes, | 728 bool prefer_aes, |
729 int max_number_of_lossy_connections, | |
730 float packet_loss_threshold, | |
731 int max_disabled_reasons, | |
732 int threshold_public_resets_post_handshake, | |
733 int threshold_timeouts_with_open_streams, | |
734 int socket_receive_buffer_size, | 729 int socket_receive_buffer_size, |
735 bool delay_tcp_race, | 730 bool delay_tcp_race, |
736 int max_server_configs_stored_in_properties, | 731 int max_server_configs_stored_in_properties, |
737 bool close_sessions_on_ip_change, | 732 bool close_sessions_on_ip_change, |
738 bool disable_quic_on_timeout_with_open_streams, | 733 bool disable_quic_on_timeout_with_open_streams, |
739 int idle_connection_timeout_seconds, | 734 int idle_connection_timeout_seconds, |
740 int reduced_ping_timeout_seconds, | 735 int reduced_ping_timeout_seconds, |
741 int packet_reader_yield_after_duration_milliseconds, | 736 int packet_reader_yield_after_duration_milliseconds, |
742 bool migrate_sessions_on_network_change, | 737 bool migrate_sessions_on_network_change, |
743 bool migrate_sessions_early, | 738 bool migrate_sessions_early, |
(...skipping 26 matching lines...) Expand all Loading... |
770 enable_port_selection_(enable_port_selection), | 765 enable_port_selection_(enable_port_selection), |
771 always_require_handshake_confirmation_( | 766 always_require_handshake_confirmation_( |
772 always_require_handshake_confirmation), | 767 always_require_handshake_confirmation), |
773 disable_connection_pooling_(disable_connection_pooling), | 768 disable_connection_pooling_(disable_connection_pooling), |
774 load_server_info_timeout_srtt_multiplier_( | 769 load_server_info_timeout_srtt_multiplier_( |
775 load_server_info_timeout_srtt_multiplier), | 770 load_server_info_timeout_srtt_multiplier), |
776 enable_connection_racing_(enable_connection_racing), | 771 enable_connection_racing_(enable_connection_racing), |
777 enable_non_blocking_io_(enable_non_blocking_io), | 772 enable_non_blocking_io_(enable_non_blocking_io), |
778 disable_disk_cache_(disable_disk_cache), | 773 disable_disk_cache_(disable_disk_cache), |
779 prefer_aes_(prefer_aes), | 774 prefer_aes_(prefer_aes), |
780 max_number_of_lossy_connections_(max_number_of_lossy_connections), | 775 disable_quic_on_timeout_with_open_streams_( |
781 packet_loss_threshold_(packet_loss_threshold), | 776 disable_quic_on_timeout_with_open_streams), |
782 max_disabled_reasons_(max_disabled_reasons), | |
783 num_public_resets_post_handshake_(0), | |
784 num_timeouts_with_open_streams_(0), | |
785 max_public_resets_post_handshake_(0), | |
786 max_timeouts_with_open_streams_(0), | |
787 threshold_timeouts_with_open_streams_( | |
788 threshold_timeouts_with_open_streams), | |
789 threshold_public_resets_post_handshake_( | |
790 threshold_public_resets_post_handshake), | |
791 socket_receive_buffer_size_(socket_receive_buffer_size), | 777 socket_receive_buffer_size_(socket_receive_buffer_size), |
792 delay_tcp_race_(delay_tcp_race), | 778 delay_tcp_race_(delay_tcp_race), |
793 ping_timeout_(QuicTime::Delta::FromSeconds(kPingTimeoutSecs)), | 779 ping_timeout_(QuicTime::Delta::FromSeconds(kPingTimeoutSecs)), |
794 reduced_ping_timeout_( | 780 reduced_ping_timeout_( |
795 QuicTime::Delta::FromSeconds(reduced_ping_timeout_seconds)), | 781 QuicTime::Delta::FromSeconds(reduced_ping_timeout_seconds)), |
796 yield_after_packets_(kQuicYieldAfterPacketsRead), | 782 yield_after_packets_(kQuicYieldAfterPacketsRead), |
797 yield_after_duration_(QuicTime::Delta::FromMilliseconds( | 783 yield_after_duration_(QuicTime::Delta::FromMilliseconds( |
798 packet_reader_yield_after_duration_milliseconds)), | 784 packet_reader_yield_after_duration_milliseconds)), |
799 close_sessions_on_ip_change_(close_sessions_on_ip_change), | 785 close_sessions_on_ip_change_(close_sessions_on_ip_change), |
800 migrate_sessions_on_network_change_( | 786 migrate_sessions_on_network_change_( |
801 migrate_sessions_on_network_change && | 787 migrate_sessions_on_network_change && |
802 NetworkChangeNotifier::AreNetworkHandlesSupported()), | 788 NetworkChangeNotifier::AreNetworkHandlesSupported()), |
803 migrate_sessions_early_(migrate_sessions_early && | 789 migrate_sessions_early_(migrate_sessions_early && |
804 migrate_sessions_on_network_change_), | 790 migrate_sessions_on_network_change_), |
805 allow_server_migration_(allow_server_migration), | 791 allow_server_migration_(allow_server_migration), |
806 force_hol_blocking_(force_hol_blocking), | 792 force_hol_blocking_(force_hol_blocking), |
807 race_cert_verification_(race_cert_verification), | 793 race_cert_verification_(race_cert_verification), |
808 quic_do_not_fragment_(quic_do_not_fragment), | 794 quic_do_not_fragment_(quic_do_not_fragment), |
809 port_seed_(random_generator_->RandUint64()), | 795 port_seed_(random_generator_->RandUint64()), |
810 check_persisted_supports_quic_(true), | 796 check_persisted_supports_quic_(true), |
811 has_initialized_data_(false), | 797 has_initialized_data_(false), |
812 num_push_streams_created_(0), | 798 num_push_streams_created_(0), |
813 status_(OPEN), | 799 status_(OPEN), |
814 task_runner_(nullptr), | 800 task_runner_(nullptr), |
815 ssl_config_service_(ssl_config_service), | 801 ssl_config_service_(ssl_config_service), |
816 weak_factory_(this) { | 802 weak_factory_(this) { |
817 if (ssl_config_service_.get()) | 803 if (ssl_config_service_.get()) |
818 ssl_config_service_->AddObserver(this); | 804 ssl_config_service_->AddObserver(this); |
819 if (disable_quic_on_timeout_with_open_streams) | |
820 threshold_timeouts_with_open_streams_ = 1; | |
821 DCHECK(transport_security_state_); | 805 DCHECK(transport_security_state_); |
822 DCHECK(http_server_properties_); | 806 DCHECK(http_server_properties_); |
823 crypto_config_.set_user_agent_id(user_agent_id); | 807 crypto_config_.set_user_agent_id(user_agent_id); |
824 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); | 808 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); |
825 crypto_config_.AddCanonicalSuffix(".ggpht.com"); | 809 crypto_config_.AddCanonicalSuffix(".ggpht.com"); |
826 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); | 810 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); |
827 crypto_config_.AddCanonicalSuffix(".googleusercontent.com"); | 811 crypto_config_.AddCanonicalSuffix(".googleusercontent.com"); |
828 // TODO(rtenneti): http://crbug.com/487355. Temporary fix for b/20760730 until | 812 // TODO(rtenneti): http://crbug.com/487355. Temporary fix for b/20760730 until |
829 // channel_id_service is supported in cronet. | 813 // channel_id_service is supported in cronet. |
830 if (channel_id_service) { | 814 if (channel_id_service) { |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 void QuicStreamFactory::OnCertVerifyJobComplete(CertVerifierJob* job, int rv) { | 1130 void QuicStreamFactory::OnCertVerifyJobComplete(CertVerifierJob* job, int rv) { |
1147 active_cert_verifier_jobs_.erase(job->server_id()); | 1131 active_cert_verifier_jobs_.erase(job->server_id()); |
1148 } | 1132 } |
1149 | 1133 |
1150 std::unique_ptr<QuicHttpStream> QuicStreamFactory::CreateFromSession( | 1134 std::unique_ptr<QuicHttpStream> QuicStreamFactory::CreateFromSession( |
1151 QuicChromiumClientSession* session) { | 1135 QuicChromiumClientSession* session) { |
1152 return std::unique_ptr<QuicHttpStream>( | 1136 return std::unique_ptr<QuicHttpStream>( |
1153 new QuicHttpStream(session->GetWeakPtr())); | 1137 new QuicHttpStream(session->GetWeakPtr())); |
1154 } | 1138 } |
1155 | 1139 |
1156 QuicChromiumClientSession::QuicDisabledReason | 1140 bool QuicStreamFactory::IsQuicDisabled() const { |
1157 QuicStreamFactory::QuicDisabledReason(uint16_t port) const { | |
1158 if (max_number_of_lossy_connections_ > 0 && | |
1159 number_of_lossy_connections_.find(port) != | |
1160 number_of_lossy_connections_.end() && | |
1161 number_of_lossy_connections_.at(port) >= | |
1162 max_number_of_lossy_connections_) { | |
1163 return QuicChromiumClientSession::QUIC_DISABLED_BAD_PACKET_LOSS_RATE; | |
1164 } | |
1165 if (threshold_public_resets_post_handshake_ > 0 && | |
1166 num_public_resets_post_handshake_ >= | |
1167 threshold_public_resets_post_handshake_) { | |
1168 return QuicChromiumClientSession::QUIC_DISABLED_PUBLIC_RESET_POST_HANDSHAKE; | |
1169 } | |
1170 if (threshold_timeouts_with_open_streams_ > 0 && | |
1171 num_timeouts_with_open_streams_ >= | |
1172 threshold_timeouts_with_open_streams_) { | |
1173 return QuicChromiumClientSession::QUIC_DISABLED_TIMEOUT_WITH_OPEN_STREAMS; | |
1174 } | |
1175 return QuicChromiumClientSession::QUIC_DISABLED_NOT; | |
1176 } | |
1177 | |
1178 const char* QuicStreamFactory::QuicDisabledReasonString() const { | |
1179 // TODO(ckrasic) - better solution for port/lossy connections? | |
1180 const uint16_t port = 443; | |
1181 switch (QuicDisabledReason(port)) { | |
1182 case QuicChromiumClientSession::QUIC_DISABLED_BAD_PACKET_LOSS_RATE: | |
1183 return "Bad packet loss rate."; | |
1184 case QuicChromiumClientSession::QUIC_DISABLED_PUBLIC_RESET_POST_HANDSHAKE: | |
1185 return "Public resets after successful handshakes."; | |
1186 case QuicChromiumClientSession::QUIC_DISABLED_TIMEOUT_WITH_OPEN_STREAMS: | |
1187 return "Connection timeouts with streams open."; | |
1188 default: | |
1189 return ""; | |
1190 } | |
1191 } | |
1192 | |
1193 bool QuicStreamFactory::IsQuicDisabled(uint16_t port) const { | |
1194 return status_ != OPEN; | 1141 return status_ != OPEN; |
1195 } | 1142 } |
1196 | 1143 |
1197 bool QuicStreamFactory::OnHandshakeConfirmed(QuicChromiumClientSession* session, | 1144 bool QuicStreamFactory::OnHandshakeConfirmed( |
1198 float packet_loss_rate) { | 1145 QuicChromiumClientSession* session) { |
1199 DCHECK(session); | 1146 if (!IsQuicDisabled()) |
1200 uint16_t port = session->server_id().port(); | |
1201 if (packet_loss_rate < packet_loss_threshold_) { | |
1202 number_of_lossy_connections_[port] = 0; | |
1203 return false; | 1147 return false; |
1204 } | |
1205 | 1148 |
1206 // We mark it as recently broken, which means that 0-RTT will be disabled | 1149 session->CloseSessionOnErrorAndNotifyFactoryLater( |
1207 // but we'll still race. | 1150 ERR_ABORTED, QUIC_TIMEOUTS_WITH_OPEN_STREAMS); |
1208 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | |
1209 AlternativeService(QUIC, session->server_id().host(), port)); | |
1210 | 1151 |
1211 bool was_quic_disabled = IsQuicDisabled(port); | 1152 return true; |
1212 ++number_of_lossy_connections_[port]; | |
1213 | |
1214 // Collect data for port 443 for packet loss events. | |
1215 if (port == 443 && max_number_of_lossy_connections_ > 0) { | |
1216 UMA_HISTOGRAM_SPARSE_SLOWLY( | |
1217 base::StringPrintf("Net.QuicStreamFactory.BadPacketLossEvents%d", | |
1218 max_number_of_lossy_connections_), | |
1219 std::min(number_of_lossy_connections_[port], | |
1220 max_number_of_lossy_connections_)); | |
1221 } | |
1222 | |
1223 MaybeDisableQuic(port); | |
1224 | |
1225 bool is_quic_disabled = IsQuicDisabled(port); | |
1226 if (is_quic_disabled) { | |
1227 // Close QUIC connection if Quic is disabled for this port. | |
1228 session->CloseSessionOnErrorAndNotifyFactoryLater( | |
1229 ERR_ABORTED, QUIC_BAD_PACKET_LOSS_RATE); | |
1230 | |
1231 // If this bad packet loss rate disabled the QUIC, then record it. | |
1232 if (!was_quic_disabled) | |
1233 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicStreamFactory.QuicIsDisabled", port); | |
1234 } | |
1235 return is_quic_disabled; | |
1236 } | 1153 } |
1237 | 1154 |
1238 void QuicStreamFactory::OnTcpJobCompleted(bool succeeded) { | 1155 void QuicStreamFactory::OnTcpJobCompleted(bool succeeded) { |
1239 if (status_ != CLOSED) | 1156 if (status_ != CLOSED) |
1240 return; | 1157 return; |
1241 | 1158 |
1242 // If QUIC connections are failing while TCP connections are working, | 1159 // If QUIC connections are failing while TCP connections are working, |
1243 // then stop using QUIC. On the other hand if both QUIC and TCP are | 1160 // then stop using QUIC. On the other hand if both QUIC and TCP are |
1244 // failing, then attempt to use QUIC again. | 1161 // failing, then attempt to use QUIC again. |
1245 if (succeeded) { | 1162 if (succeeded) { |
1246 status_ = DISABLED; | 1163 status_ = DISABLED; |
1247 return; | 1164 return; |
1248 } | 1165 } |
1249 | 1166 |
1250 status_ = OPEN; | 1167 status_ = OPEN; |
1251 num_timeouts_with_open_streams_ = 0; | |
1252 } | 1168 } |
1253 | 1169 |
1254 void QuicStreamFactory::OnIdleSession(QuicChromiumClientSession* session) {} | 1170 void QuicStreamFactory::OnIdleSession(QuicChromiumClientSession* session) {} |
1255 | 1171 |
1256 void QuicStreamFactory::OnSessionGoingAway(QuicChromiumClientSession* session) { | 1172 void QuicStreamFactory::OnSessionGoingAway(QuicChromiumClientSession* session) { |
1257 const AliasSet& aliases = session_aliases_[session]; | 1173 const AliasSet& aliases = session_aliases_[session]; |
1258 for (AliasSet::const_iterator it = aliases.begin(); it != aliases.end(); | 1174 for (AliasSet::const_iterator it = aliases.begin(); it != aliases.end(); |
1259 ++it) { | 1175 ++it) { |
1260 const QuicServerId& server_id = it->server_id(); | 1176 const QuicServerId& server_id = it->server_id(); |
1261 DCHECK(active_sessions_.count(server_id)); | 1177 DCHECK(active_sessions_.count(server_id)); |
(...skipping 11 matching lines...) Expand all Loading... |
1273 DCHECK(base::ContainsKey(session_peer_ip_, session)); | 1189 DCHECK(base::ContainsKey(session_peer_ip_, session)); |
1274 const IPEndPoint peer_address = session_peer_ip_[session]; | 1190 const IPEndPoint peer_address = session_peer_ip_[session]; |
1275 ip_aliases_[peer_address].erase(session); | 1191 ip_aliases_[peer_address].erase(session); |
1276 if (ip_aliases_[peer_address].empty()) | 1192 if (ip_aliases_[peer_address].empty()) |
1277 ip_aliases_.erase(peer_address); | 1193 ip_aliases_.erase(peer_address); |
1278 session_peer_ip_.erase(session); | 1194 session_peer_ip_.erase(session); |
1279 } | 1195 } |
1280 session_aliases_.erase(session); | 1196 session_aliases_.erase(session); |
1281 } | 1197 } |
1282 | 1198 |
1283 void QuicStreamFactory::MaybeDisableQuic(QuicChromiumClientSession* session) { | |
1284 DCHECK(session); | |
1285 uint16_t port = session->server_id().port(); | |
1286 if (IsQuicDisabled(port)) | |
1287 return; | |
1288 | |
1289 // Expire the oldest disabled_reason if appropriate. This enforces that we | |
1290 // only consider the max_disabled_reasons_ most recent sessions. | |
1291 QuicChromiumClientSession::QuicDisabledReason disabled_reason; | |
1292 if (static_cast<int>(disabled_reasons_.size()) == max_disabled_reasons_) { | |
1293 disabled_reason = disabled_reasons_.front(); | |
1294 disabled_reasons_.pop_front(); | |
1295 if (disabled_reason == | |
1296 QuicChromiumClientSession::QUIC_DISABLED_PUBLIC_RESET_POST_HANDSHAKE) { | |
1297 --num_public_resets_post_handshake_; | |
1298 } else if (disabled_reason == QuicChromiumClientSession:: | |
1299 QUIC_DISABLED_TIMEOUT_WITH_OPEN_STREAMS) { | |
1300 --num_timeouts_with_open_streams_; | |
1301 } | |
1302 } | |
1303 disabled_reason = session->disabled_reason(); | |
1304 disabled_reasons_.push_back(disabled_reason); | |
1305 if (disabled_reason == | |
1306 QuicChromiumClientSession::QUIC_DISABLED_PUBLIC_RESET_POST_HANDSHAKE) { | |
1307 ++num_public_resets_post_handshake_; | |
1308 } else if (disabled_reason == QuicChromiumClientSession:: | |
1309 QUIC_DISABLED_TIMEOUT_WITH_OPEN_STREAMS) { | |
1310 ++num_timeouts_with_open_streams_; | |
1311 } | |
1312 if (num_timeouts_with_open_streams_ > max_timeouts_with_open_streams_) { | |
1313 max_timeouts_with_open_streams_ = num_timeouts_with_open_streams_; | |
1314 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.QuicStreamFactory.TimeoutsWithOpenStreams", | |
1315 num_timeouts_with_open_streams_, 1, 20, 10); | |
1316 } | |
1317 | |
1318 if (num_public_resets_post_handshake_ > max_public_resets_post_handshake_) { | |
1319 max_public_resets_post_handshake_ = num_public_resets_post_handshake_; | |
1320 UMA_HISTOGRAM_CUSTOM_COUNTS( | |
1321 "Net.QuicStreamFactory.PublicResetsPostHandshake", | |
1322 num_public_resets_post_handshake_, 1, 20, 10); | |
1323 } | |
1324 | |
1325 MaybeDisableQuic(port); | |
1326 if (IsQuicDisabled(port)) { | |
1327 if (disabled_reason == | |
1328 QuicChromiumClientSession::QUIC_DISABLED_PUBLIC_RESET_POST_HANDSHAKE) { | |
1329 session->CloseSessionOnErrorAndNotifyFactoryLater( | |
1330 ERR_ABORTED, QUIC_PUBLIC_RESETS_POST_HANDSHAKE); | |
1331 } else if (disabled_reason == QuicChromiumClientSession:: | |
1332 QUIC_DISABLED_TIMEOUT_WITH_OPEN_STREAMS) { | |
1333 session->CloseSessionOnErrorAndNotifyFactoryLater( | |
1334 ERR_ABORTED, QUIC_TIMEOUTS_WITH_OPEN_STREAMS); | |
1335 } | |
1336 UMA_HISTOGRAM_ENUMERATION("Net.QuicStreamFactory.DisabledReasons", | |
1337 disabled_reason, | |
1338 QuicChromiumClientSession::QUIC_DISABLED_MAX); | |
1339 } | |
1340 } | |
1341 | |
1342 void QuicStreamFactory::MaybeDisableQuic(uint16_t port) { | |
1343 if (status_ == DISABLED) | |
1344 return; | |
1345 | |
1346 QuicChromiumClientSession::QuicDisabledReason disabled_reason = | |
1347 QuicDisabledReason(port); | |
1348 if (disabled_reason == QuicChromiumClientSession::QUIC_DISABLED_NOT) { | |
1349 DCHECK_EQ(OPEN, status_); | |
1350 return; | |
1351 } | |
1352 | |
1353 if (disabled_reason == | |
1354 QuicChromiumClientSession::QUIC_DISABLED_TIMEOUT_WITH_OPEN_STREAMS) { | |
1355 // When QUIC there are too many timeouts with open stream, the factory | |
1356 // should be closed. When TCP jobs complete, they will move the factory | |
1357 // to either fully disabled or back to open. | |
1358 status_ = CLOSED; | |
1359 DCHECK(IsQuicDisabled(port)); | |
1360 DCHECK_NE(QuicChromiumClientSession::QuicDisabledReason(port), | |
1361 QuicChromiumClientSession::QUIC_DISABLED_NOT); | |
1362 return; | |
1363 } | |
1364 | |
1365 status_ = DISABLED; | |
1366 DCHECK(IsQuicDisabled(port)); | |
1367 DCHECK_NE(QuicChromiumClientSession::QuicDisabledReason(port), | |
1368 QuicChromiumClientSession::QUIC_DISABLED_NOT); | |
1369 } | |
1370 | |
1371 void QuicStreamFactory::OnSessionClosed(QuicChromiumClientSession* session) { | 1199 void QuicStreamFactory::OnSessionClosed(QuicChromiumClientSession* session) { |
1372 DCHECK_EQ(0u, session->GetNumActiveStreams()); | 1200 DCHECK_EQ(0u, session->GetNumActiveStreams()); |
1373 MaybeDisableQuic(session); | |
1374 OnSessionGoingAway(session); | 1201 OnSessionGoingAway(session); |
1375 delete session; | 1202 delete session; |
1376 all_sessions_.erase(session); | 1203 all_sessions_.erase(session); |
1377 } | 1204 } |
1378 | 1205 |
1379 void QuicStreamFactory::OnTimeoutWithOpenStreams() { | 1206 void QuicStreamFactory::OnTimeoutWithOpenStreams() { |
1380 // Reduce PING timeout when connection times out with open stream. | 1207 // Reduce PING timeout when connection times out with open stream. |
1381 if (ping_timeout_ > reduced_ping_timeout_) { | 1208 if (ping_timeout_ > reduced_ping_timeout_) { |
1382 ping_timeout_ = reduced_ping_timeout_; | 1209 ping_timeout_ = reduced_ping_timeout_; |
1383 } | 1210 } |
| 1211 if (disable_quic_on_timeout_with_open_streams_) |
| 1212 status_ = CLOSED; |
1384 } | 1213 } |
1385 | 1214 |
1386 void QuicStreamFactory::CancelRequest(QuicStreamRequest* request) { | 1215 void QuicStreamFactory::CancelRequest(QuicStreamRequest* request) { |
1387 RequestMap::iterator request_it = active_requests_.find(request); | 1216 RequestMap::iterator request_it = active_requests_.find(request); |
1388 DCHECK(request_it != active_requests_.end()); | 1217 DCHECK(request_it != active_requests_.end()); |
1389 const QuicServerId& server_id = request_it->second; | 1218 const QuicServerId& server_id = request_it->second; |
1390 job_requests_map_[server_id].erase(request); | 1219 job_requests_map_[server_id].erase(request); |
1391 active_requests_.erase(request_it); | 1220 active_requests_.erase(request_it); |
1392 } | 1221 } |
1393 | 1222 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 return std::move(list); | 1257 return std::move(list); |
1429 } | 1258 } |
1430 | 1259 |
1431 void QuicStreamFactory::ClearCachedStatesInCryptoConfig( | 1260 void QuicStreamFactory::ClearCachedStatesInCryptoConfig( |
1432 const base::Callback<bool(const GURL&)>& origin_filter) { | 1261 const base::Callback<bool(const GURL&)>& origin_filter) { |
1433 ServerIdOriginFilter filter(origin_filter); | 1262 ServerIdOriginFilter filter(origin_filter); |
1434 crypto_config_.ClearCachedStates(filter); | 1263 crypto_config_.ClearCachedStates(filter); |
1435 } | 1264 } |
1436 | 1265 |
1437 void QuicStreamFactory::OnIPAddressChanged() { | 1266 void QuicStreamFactory::OnIPAddressChanged() { |
1438 num_timeouts_with_open_streams_ = 0; | |
1439 status_ = OPEN; | 1267 status_ = OPEN; |
1440 CloseAllSessions(ERR_NETWORK_CHANGED, QUIC_IP_ADDRESS_CHANGED); | 1268 CloseAllSessions(ERR_NETWORK_CHANGED, QUIC_IP_ADDRESS_CHANGED); |
1441 set_require_confirmation(true); | 1269 set_require_confirmation(true); |
1442 } | 1270 } |
1443 | 1271 |
1444 void QuicStreamFactory::OnNetworkConnected(NetworkHandle network) { | 1272 void QuicStreamFactory::OnNetworkConnected(NetworkHandle network) { |
1445 num_timeouts_with_open_streams_ = 0; | |
1446 status_ = OPEN; | 1273 status_ = OPEN; |
1447 } | 1274 } |
1448 | 1275 |
1449 void QuicStreamFactory::OnNetworkMadeDefault(NetworkHandle network) { | 1276 void QuicStreamFactory::OnNetworkMadeDefault(NetworkHandle network) { |
1450 ScopedConnectionMigrationEventLog scoped_event_log(net_log_, | 1277 ScopedConnectionMigrationEventLog scoped_event_log(net_log_, |
1451 "OnNetworkMadeDefault"); | 1278 "OnNetworkMadeDefault"); |
1452 DCHECK_NE(NetworkChangeNotifier::kInvalidNetworkHandle, network); | 1279 DCHECK_NE(NetworkChangeNotifier::kInvalidNetworkHandle, network); |
1453 MaybeMigrateOrCloseSessions(network, /*close_if_cannot_migrate=*/false, | 1280 MaybeMigrateOrCloseSessions(network, /*close_if_cannot_migrate=*/false, |
1454 scoped_event_log.net_log()); | 1281 scoped_event_log.net_log()); |
1455 set_require_confirmation(true); | 1282 set_require_confirmation(true); |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2052 // Since the session was active, there's no longer an | 1879 // Since the session was active, there's no longer an |
2053 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP | 1880 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP |
2054 // job also fails. So to avoid not using QUIC when we otherwise could, we mark | 1881 // job also fails. So to avoid not using QUIC when we otherwise could, we mark |
2055 // it as recently broken, which means that 0-RTT will be disabled but we'll | 1882 // it as recently broken, which means that 0-RTT will be disabled but we'll |
2056 // still race. | 1883 // still race. |
2057 http_server_properties_->MarkAlternativeServiceRecentlyBroken( | 1884 http_server_properties_->MarkAlternativeServiceRecentlyBroken( |
2058 alternative_service); | 1885 alternative_service); |
2059 } | 1886 } |
2060 | 1887 |
2061 } // namespace net | 1888 } // namespace net |
OLD | NEW |