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

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

Issue 2301453002: Quic use reduced PING timeout when previous connection times out with open streams (Closed)
Patch Set: address rch's comments Created 4 years, 3 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
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 <openssl/aead.h> 7 #include <openssl/aead.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <tuple> 10 #include <tuple>
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 float packet_loss_threshold, 730 float packet_loss_threshold,
731 int max_disabled_reasons, 731 int max_disabled_reasons,
732 int threshold_public_resets_post_handshake, 732 int threshold_public_resets_post_handshake,
733 int threshold_timeouts_with_open_streams, 733 int threshold_timeouts_with_open_streams,
734 int socket_receive_buffer_size, 734 int socket_receive_buffer_size,
735 bool delay_tcp_race, 735 bool delay_tcp_race,
736 int max_server_configs_stored_in_properties, 736 int max_server_configs_stored_in_properties,
737 bool close_sessions_on_ip_change, 737 bool close_sessions_on_ip_change,
738 bool disable_quic_on_timeout_with_open_streams, 738 bool disable_quic_on_timeout_with_open_streams,
739 int idle_connection_timeout_seconds, 739 int idle_connection_timeout_seconds,
740 int reduced_ping_timeout_seconds,
740 int packet_reader_yield_after_duration_milliseconds, 741 int packet_reader_yield_after_duration_milliseconds,
741 bool migrate_sessions_on_network_change, 742 bool migrate_sessions_on_network_change,
742 bool migrate_sessions_early, 743 bool migrate_sessions_early,
743 bool allow_server_migration, 744 bool allow_server_migration,
744 bool force_hol_blocking, 745 bool force_hol_blocking,
745 bool race_cert_verification, 746 bool race_cert_verification,
746 const QuicTagVector& connection_options, 747 const QuicTagVector& connection_options,
747 bool enable_token_binding) 748 bool enable_token_binding)
748 : require_confirmation_(true), 749 : require_confirmation_(true),
749 net_log_(net_log), 750 net_log_(net_log),
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 num_public_resets_post_handshake_(0), 782 num_public_resets_post_handshake_(0),
782 num_timeouts_with_open_streams_(0), 783 num_timeouts_with_open_streams_(0),
783 max_public_resets_post_handshake_(0), 784 max_public_resets_post_handshake_(0),
784 max_timeouts_with_open_streams_(0), 785 max_timeouts_with_open_streams_(0),
785 threshold_timeouts_with_open_streams_( 786 threshold_timeouts_with_open_streams_(
786 threshold_timeouts_with_open_streams), 787 threshold_timeouts_with_open_streams),
787 threshold_public_resets_post_handshake_( 788 threshold_public_resets_post_handshake_(
788 threshold_public_resets_post_handshake), 789 threshold_public_resets_post_handshake),
789 socket_receive_buffer_size_(socket_receive_buffer_size), 790 socket_receive_buffer_size_(socket_receive_buffer_size),
790 delay_tcp_race_(delay_tcp_race), 791 delay_tcp_race_(delay_tcp_race),
792 ping_timeout_(QuicTime::Delta::FromSeconds(kPingTimeoutSecs)),
793 reduced_ping_timeout_(
794 QuicTime::Delta::FromSeconds(reduced_ping_timeout_seconds)),
791 yield_after_packets_(kQuicYieldAfterPacketsRead), 795 yield_after_packets_(kQuicYieldAfterPacketsRead),
792 yield_after_duration_(QuicTime::Delta::FromMilliseconds( 796 yield_after_duration_(QuicTime::Delta::FromMilliseconds(
793 packet_reader_yield_after_duration_milliseconds)), 797 packet_reader_yield_after_duration_milliseconds)),
794 close_sessions_on_ip_change_(close_sessions_on_ip_change), 798 close_sessions_on_ip_change_(close_sessions_on_ip_change),
795 migrate_sessions_on_network_change_( 799 migrate_sessions_on_network_change_(
796 migrate_sessions_on_network_change && 800 migrate_sessions_on_network_change &&
797 NetworkChangeNotifier::AreNetworkHandlesSupported()), 801 NetworkChangeNotifier::AreNetworkHandlesSupported()),
798 migrate_sessions_early_(migrate_sessions_early && 802 migrate_sessions_early_(migrate_sessions_early &&
799 migrate_sessions_on_network_change_), 803 migrate_sessions_on_network_change_),
800 allow_server_migration_(allow_server_migration), 804 allow_server_migration_(allow_server_migration),
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 } 1367 }
1364 1368
1365 void QuicStreamFactory::OnSessionClosed(QuicChromiumClientSession* session) { 1369 void QuicStreamFactory::OnSessionClosed(QuicChromiumClientSession* session) {
1366 DCHECK_EQ(0u, session->GetNumActiveStreams()); 1370 DCHECK_EQ(0u, session->GetNumActiveStreams());
1367 MaybeDisableQuic(session); 1371 MaybeDisableQuic(session);
1368 OnSessionGoingAway(session); 1372 OnSessionGoingAway(session);
1369 delete session; 1373 delete session;
1370 all_sessions_.erase(session); 1374 all_sessions_.erase(session);
1371 } 1375 }
1372 1376
1377 void QuicStreamFactory::OnTimeoutWithOpenStreams() {
1378 // Reduce PING timeout when connection times out with open stream.
1379 if (ping_timeout_ > reduced_ping_timeout_) {
1380 ping_timeout_ = reduced_ping_timeout_;
1381 }
1382 }
1383
1373 void QuicStreamFactory::CancelRequest(QuicStreamRequest* request) { 1384 void QuicStreamFactory::CancelRequest(QuicStreamRequest* request) {
1374 RequestMap::iterator request_it = active_requests_.find(request); 1385 RequestMap::iterator request_it = active_requests_.find(request);
1375 DCHECK(request_it != active_requests_.end()); 1386 DCHECK(request_it != active_requests_.end());
1376 const QuicServerId& server_id = request_it->second; 1387 const QuicServerId& server_id = request_it->second;
1377 job_requests_map_[server_id].erase(request); 1388 job_requests_map_[server_id].erase(request);
1378 active_requests_.erase(request_it); 1389 active_requests_.erase(request_it);
1379 } 1390 }
1380 1391
1381 void QuicStreamFactory::CloseAllSessions(int error, QuicErrorCode quic_error) { 1392 void QuicStreamFactory::CloseAllSessions(int error, QuicErrorCode quic_error) {
1382 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.CloseAllSessionsError", -error); 1393 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.CloseAllSessionsError", -error);
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1785 alarm_factory_.reset(new QuicChromiumAlarmFactory( 1796 alarm_factory_.reset(new QuicChromiumAlarmFactory(
1786 base::ThreadTaskRunnerHandle::Get().get(), clock_.get())); 1797 base::ThreadTaskRunnerHandle::Get().get(), clock_.get()));
1787 } 1798 }
1788 QuicConnectionId connection_id = random_generator_->RandUint64(); 1799 QuicConnectionId connection_id = random_generator_->RandUint64();
1789 InitializeCachedStateInCryptoConfig(server_id, server_info, &connection_id); 1800 InitializeCachedStateInCryptoConfig(server_id, server_info, &connection_id);
1790 1801
1791 QuicChromiumPacketWriter* writer = new QuicChromiumPacketWriter(socket.get()); 1802 QuicChromiumPacketWriter* writer = new QuicChromiumPacketWriter(socket.get());
1792 QuicConnection* connection = new QuicConnection( 1803 QuicConnection* connection = new QuicConnection(
1793 connection_id, addr, helper_.get(), alarm_factory_.get(), writer, 1804 connection_id, addr, helper_.get(), alarm_factory_.get(), writer,
1794 true /* owns_writer */, Perspective::IS_CLIENT, supported_versions_); 1805 true /* owns_writer */, Perspective::IS_CLIENT, supported_versions_);
1806 connection->set_ping_timeout(ping_timeout_);
1795 connection->SetMaxPacketLength(max_packet_length_); 1807 connection->SetMaxPacketLength(max_packet_length_);
1796 1808
1797 QuicConfig config = config_; 1809 QuicConfig config = config_;
1798 config.SetSocketReceiveBufferToSend(socket_receive_buffer_size_); 1810 config.SetSocketReceiveBufferToSend(socket_receive_buffer_size_);
1799 config.set_max_undecryptable_packets(kMaxUndecryptablePackets); 1811 config.set_max_undecryptable_packets(kMaxUndecryptablePackets);
1800 config.SetInitialSessionFlowControlWindowToSend( 1812 config.SetInitialSessionFlowControlWindowToSend(
1801 kQuicSessionMaxRecvWindowSize); 1813 kQuicSessionMaxRecvWindowSize);
1802 config.SetInitialStreamFlowControlWindowToSend(kQuicStreamMaxRecvWindowSize); 1814 config.SetInitialStreamFlowControlWindowToSend(kQuicStreamMaxRecvWindowSize);
1803 int64_t srtt = GetServerNetworkStatsSmoothedRttInMicroseconds(server_id); 1815 int64_t srtt = GetServerNetworkStatsSmoothedRttInMicroseconds(server_id);
1804 if (srtt > 0) 1816 if (srtt > 0)
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
2027 // Since the session was active, there's no longer an 2039 // Since the session was active, there's no longer an
2028 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP 2040 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP
2029 // job also fails. So to avoid not using QUIC when we otherwise could, we mark 2041 // job also fails. So to avoid not using QUIC when we otherwise could, we mark
2030 // it as recently broken, which means that 0-RTT will be disabled but we'll 2042 // it as recently broken, which means that 0-RTT will be disabled but we'll
2031 // still race. 2043 // still race.
2032 http_server_properties_->MarkAlternativeServiceRecentlyBroken( 2044 http_server_properties_->MarkAlternativeServiceRecentlyBroken(
2033 alternative_service); 2045 alternative_service);
2034 } 2046 }
2035 2047
2036 } // namespace net 2048 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698