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

Unified Diff: net/quic/quic_connection.cc

Issue 1664763003: Rename QUIC connection timeout error codes to be more descriptive. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@113275797
Patch Set: Created 4 years, 11 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 | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »
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 6c6a1f27757805f2ee97a6f632e77c07c2fb4881..90350a0c51fbb344e61856689e81fe67af269e6d 100644
--- a/net/quic/quic_connection.cc
+++ b/net/quic/quic_connection.cc
@@ -304,7 +304,7 @@ QuicConnection::QuicConnection(QuicConnectionId connection_id,
fec_alarm_(helper->CreateAlarm(arena_.New<FecAlarm>(&packet_generator_),
&arena_)),
idle_network_timeout_(QuicTime::Delta::Infinite()),
- overall_connection_timeout_(QuicTime::Delta::Infinite()),
+ handshake_timeout_(QuicTime::Delta::Infinite()),
time_of_last_received_packet_(clock_->ApproximateNow()),
time_of_last_sent_new_packet_(clock_->ApproximateNow()),
last_send_for_timeout_(clock_->ApproximateNow()),
@@ -369,6 +369,7 @@ void QuicConnection::ClearQueuedPackets() {
void QuicConnection::SetFromConfig(const QuicConfig& config) {
if (config.negotiated()) {
+ // Handshake complete, set handshake timeout to Infinite.
SetNetworkTimeouts(QuicTime::Delta::Infinite(),
config.IdleConnectionStateLifetime());
if (config.SilentClose()) {
@@ -2058,7 +2059,7 @@ void QuicConnection::SendConnectionClosePacket(QuicErrorCode error,
// Don't send explicit connection close packets for timeouts.
// This is particularly important on mobile, where connections are short.
if (silent_close_enabled_ &&
- error == QuicErrorCode::QUIC_CONNECTION_TIMED_OUT) {
+ error == QuicErrorCode::QUIC_NETWORK_IDLE_TIMEOUT) {
return;
}
ClearQueuedPackets();
@@ -2171,11 +2172,11 @@ bool QuicConnection::CanWriteStreamData() {
return ShouldGeneratePacket(HAS_RETRANSMITTABLE_DATA, pending_handshake);
}
-void QuicConnection::SetNetworkTimeouts(QuicTime::Delta overall_timeout,
+void QuicConnection::SetNetworkTimeouts(QuicTime::Delta handshake_timeout,
QuicTime::Delta idle_timeout) {
- QUIC_BUG_IF(idle_timeout > overall_timeout)
+ QUIC_BUG_IF(idle_timeout > handshake_timeout)
<< "idle_timeout:" << idle_timeout.ToMilliseconds()
- << " overall_timeout:" << overall_timeout.ToMilliseconds();
+ << " handshake_timeout:" << handshake_timeout.ToMilliseconds();
// Adjust the idle timeout on client and server to prevent clients from
// sending requests to servers which have already closed the connection.
if (perspective_ == Perspective::IS_SERVER) {
@@ -2183,7 +2184,7 @@ void QuicConnection::SetNetworkTimeouts(QuicTime::Delta overall_timeout,
} else if (idle_timeout > QuicTime::Delta::FromSeconds(1)) {
idle_timeout = idle_timeout.Subtract(QuicTime::Delta::FromSeconds(1));
}
- overall_connection_timeout_ = overall_timeout;
+ handshake_timeout_ = handshake_timeout;
idle_network_timeout_ = idle_timeout;
SetTimeoutAlarm();
@@ -2212,23 +2213,21 @@ void QuicConnection::CheckForTimeout() {
<< idle_network_timeout_.ToMicroseconds();
if (idle_duration >= idle_network_timeout_) {
DVLOG(1) << ENDPOINT << "Connection timedout due to no network activity.";
- SendConnectionCloseWithDetails(QUIC_CONNECTION_TIMED_OUT,
+ SendConnectionCloseWithDetails(QUIC_NETWORK_IDLE_TIMEOUT,
"No recent network activity");
return;
}
- if (!overall_connection_timeout_.IsInfinite()) {
+ if (!handshake_timeout_.IsInfinite()) {
QuicTime::Delta connected_duration =
now.Subtract(stats_.connection_creation_time);
DVLOG(1) << ENDPOINT
<< "connection time: " << connected_duration.ToMicroseconds()
- << " overall timeout: "
- << overall_connection_timeout_.ToMicroseconds();
- if (connected_duration >= overall_connection_timeout_) {
- DVLOG(1) << ENDPOINT
- << "Connection timedout due to overall connection timeout.";
- SendConnectionCloseWithDetails(QUIC_CONNECTION_OVERALL_TIMED_OUT,
- "Overall timeout expired");
+ << " handshake timeout: " << handshake_timeout_.ToMicroseconds();
+ if (connected_duration >= handshake_timeout_) {
+ DVLOG(1) << ENDPOINT << "Connection timedout due to handshake timeout.";
+ SendConnectionCloseWithDetails(QUIC_HANDSHAKE_TIMEOUT,
+ "Handshake timeout expired");
return;
}
}
@@ -2241,10 +2240,9 @@ void QuicConnection::SetTimeoutAlarm() {
max(time_of_last_received_packet_, time_of_last_sent_new_packet_);
QuicTime deadline = time_of_last_packet.Add(idle_network_timeout_);
- if (!overall_connection_timeout_.IsInfinite()) {
+ if (!handshake_timeout_.IsInfinite()) {
deadline =
- min(deadline,
- stats_.connection_creation_time.Add(overall_connection_timeout_));
+ min(deadline, stats_.connection_creation_time.Add(handshake_timeout_));
}
timeout_alarm_->Cancel();
« no previous file with comments | « net/quic/quic_connection.h ('k') | net/quic/quic_connection_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698