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

Side by Side Diff: net/quic/quic_connection.cc

Issue 651463004: Set the server's idle timeout to 2s longer than the negotiated value(30s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Call_SetDefaults_from_constructor_76709273
Patch Set: Created 6 years, 2 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 | « no previous file | net/quic/quic_session_test.cc » ('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/quic_connection.h" 5 #include "net/quic/quic_connection.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 // we had queued and we're still not blocked, let the visitor know it can 1849 // we had queued and we're still not blocked, let the visitor know it can
1850 // write more. 1850 // write more.
1851 return ShouldGeneratePacket(NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA, 1851 return ShouldGeneratePacket(NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA,
1852 pending_handshake); 1852 pending_handshake);
1853 } 1853 }
1854 1854
1855 void QuicConnection::SetIdleNetworkTimeout(QuicTime::Delta timeout) { 1855 void QuicConnection::SetIdleNetworkTimeout(QuicTime::Delta timeout) {
1856 // Adjust the idle timeout on client and server to prevent clients from 1856 // Adjust the idle timeout on client and server to prevent clients from
1857 // sending requests to servers which have already closed the connection. 1857 // sending requests to servers which have already closed the connection.
1858 if (is_server_) { 1858 if (is_server_) {
1859 timeout = timeout.Add(QuicTime::Delta::FromSeconds(1)); 1859 timeout = timeout.Add(QuicTime::Delta::FromSeconds(3));
1860 } else if (timeout > QuicTime::Delta::FromSeconds(1)) { 1860 } else if (timeout > QuicTime::Delta::FromSeconds(1)) {
1861 timeout = timeout.Subtract(QuicTime::Delta::FromSeconds(1)); 1861 timeout = timeout.Subtract(QuicTime::Delta::FromSeconds(1));
1862 } 1862 }
1863 1863
1864 if (timeout < idle_network_timeout_) { 1864 if (timeout < idle_network_timeout_) {
1865 idle_network_timeout_ = timeout; 1865 idle_network_timeout_ = timeout;
1866 if (FLAGS_quic_timeouts_only_from_alarms) { 1866 if (FLAGS_quic_timeouts_only_from_alarms) {
1867 SetTimeoutAlarm(); 1867 SetTimeoutAlarm();
1868 } else { 1868 } else {
1869 CheckForTimeout(); 1869 CheckForTimeout();
(...skipping 17 matching lines...) Expand all
1887 } 1887 }
1888 1888
1889 void QuicConnection::SetNetworkTimeouts(QuicTime::Delta overall_timeout, 1889 void QuicConnection::SetNetworkTimeouts(QuicTime::Delta overall_timeout,
1890 QuicTime::Delta idle_timeout) { 1890 QuicTime::Delta idle_timeout) {
1891 LOG_IF(DFATAL, idle_timeout > overall_timeout) 1891 LOG_IF(DFATAL, idle_timeout > overall_timeout)
1892 << "idle_timeout:" << idle_timeout.ToMilliseconds() 1892 << "idle_timeout:" << idle_timeout.ToMilliseconds()
1893 << " overall_timeout:" << overall_timeout.ToMilliseconds(); 1893 << " overall_timeout:" << overall_timeout.ToMilliseconds();
1894 // Adjust the idle timeout on client and server to prevent clients from 1894 // Adjust the idle timeout on client and server to prevent clients from
1895 // sending requests to servers which have already closed the connection. 1895 // sending requests to servers which have already closed the connection.
1896 if (is_server_) { 1896 if (is_server_) {
1897 idle_timeout = idle_timeout.Add(QuicTime::Delta::FromSeconds(1)); 1897 idle_timeout = idle_timeout.Add(QuicTime::Delta::FromSeconds(3));
1898 } else if (idle_timeout > QuicTime::Delta::FromSeconds(1)) { 1898 } else if (idle_timeout > QuicTime::Delta::FromSeconds(1)) {
1899 idle_timeout = idle_timeout.Subtract(QuicTime::Delta::FromSeconds(1)); 1899 idle_timeout = idle_timeout.Subtract(QuicTime::Delta::FromSeconds(1));
1900 } 1900 }
1901 overall_connection_timeout_ = overall_timeout; 1901 overall_connection_timeout_ = overall_timeout;
1902 idle_network_timeout_ = idle_timeout; 1902 idle_network_timeout_ = idle_timeout;
1903 1903
1904 SetTimeoutAlarm(); 1904 SetTimeoutAlarm();
1905 } 1905 }
1906 1906
1907 void QuicConnection::CheckForTimeout() { 1907 void QuicConnection::CheckForTimeout() {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2031 } 2031 }
2032 for (size_t i = 0; i < retransmittable_frames->frames().size(); ++i) { 2032 for (size_t i = 0; i < retransmittable_frames->frames().size(); ++i) {
2033 if (retransmittable_frames->frames()[i].type == CONNECTION_CLOSE_FRAME) { 2033 if (retransmittable_frames->frames()[i].type == CONNECTION_CLOSE_FRAME) {
2034 return true; 2034 return true;
2035 } 2035 }
2036 } 2036 }
2037 return false; 2037 return false;
2038 } 2038 }
2039 2039
2040 } // namespace net 2040 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/quic_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698