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

Unified Diff: net/quic/quic_connection.cc

Issue 605903002: Do not timeout QUIC connections when settings the timeouts from (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Factor_out_QUIC_timeout_alarm_75915264
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/quic/quic_connection_test.cc » ('j') | net/quic/quic_flags.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_connection.cc
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc
index e25c70097e454beec6baba9bb1ec72afc86afecc..46e6ea137193110c255c46c9eaac4b41e397dcf1 100644
--- a/net/quic/quic_connection.cc
+++ b/net/quic/quic_connection.cc
@@ -219,12 +219,8 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id,
idle_network_timeout_(
QuicTime::Delta::FromSeconds(kDefaultInitialTimeoutSecs)),
overall_connection_timeout_(QuicTime::Delta::Infinite()),
- time_of_last_received_packet_(
- FLAGS_quic_timeouts_require_activity
- ? QuicTime::Zero() : clock_->ApproximateNow()),
- time_of_last_sent_new_packet_(
- FLAGS_quic_timeouts_require_activity
- ? QuicTime::Zero() : clock_->ApproximateNow()),
+ time_of_last_received_packet_(clock_->ApproximateNow()),
+ time_of_last_sent_new_packet_(clock_->ApproximateNow()),
sequence_number_of_last_sent_packet_(0),
sent_packet_manager_(
is_server, clock_, &stats_,
@@ -1880,7 +1876,11 @@ void QuicConnection::SetIdleNetworkTimeout(QuicTime::Delta timeout) {
if (timeout < idle_network_timeout_) {
idle_network_timeout_ = timeout;
- CheckForTimeout();
+ if (FLAGS_quic_timeouts_only_from_alarms) {
+ SetTimeoutAlarm();
+ } else {
+ CheckForTimeout();
+ }
} else {
idle_network_timeout_ = timeout;
}
@@ -1889,7 +1889,11 @@ void QuicConnection::SetIdleNetworkTimeout(QuicTime::Delta timeout) {
void QuicConnection::SetOverallConnectionTimeout(QuicTime::Delta timeout) {
if (timeout < overall_connection_timeout_) {
overall_connection_timeout_ = timeout;
- CheckForTimeout();
+ if (FLAGS_quic_timeouts_only_from_alarms) {
+ SetTimeoutAlarm();
+ } else {
+ CheckForTimeout();
+ }
} else {
overall_connection_timeout_ = timeout;
}
@@ -1900,14 +1904,6 @@ void QuicConnection::CheckForTimeout() {
QuicTime time_of_last_packet = max(time_of_last_received_packet_,
time_of_last_sent_new_packet_);
- // If no packets have been sent or received, then don't timeout.
- if (FLAGS_quic_timeouts_require_activity &&
- !time_of_last_packet.IsInitialized()) {
- timeout_alarm_->Cancel();
- timeout_alarm_->Set(now.Add(idle_network_timeout_));
- return;
- }
-
// |delta| can be < 0 as |now| is approximate time but |time_of_last_packet|
// is accurate time. However, this should not change the behavior of
// timeout handling.
« no previous file with comments | « no previous file | net/quic/quic_connection_test.cc » ('j') | net/quic/quic_flags.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698