| 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/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 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2194 idle_timeout = idle_timeout.Subtract(QuicTime::Delta::FromSeconds(1)); | 2194 idle_timeout = idle_timeout.Subtract(QuicTime::Delta::FromSeconds(1)); |
| 2195 } | 2195 } |
| 2196 handshake_timeout_ = handshake_timeout; | 2196 handshake_timeout_ = handshake_timeout; |
| 2197 idle_network_timeout_ = idle_timeout; | 2197 idle_network_timeout_ = idle_timeout; |
| 2198 | 2198 |
| 2199 SetTimeoutAlarm(); | 2199 SetTimeoutAlarm(); |
| 2200 } | 2200 } |
| 2201 | 2201 |
| 2202 void QuicConnection::CheckForTimeout() { | 2202 void QuicConnection::CheckForTimeout() { |
| 2203 QuicTime now = clock_->ApproximateNow(); | 2203 QuicTime now = clock_->ApproximateNow(); |
| 2204 QuicTime time_of_last_packet = QuicTime::Zero(); | 2204 QuicTime time_of_last_packet = |
| 2205 if (!FLAGS_quic_use_new_idle_timeout) { | 2205 max(time_of_last_received_packet_, last_send_for_timeout_); |
| 2206 time_of_last_packet = | |
| 2207 max(time_of_last_received_packet_, time_of_last_sent_new_packet_); | |
| 2208 } else { | |
| 2209 time_of_last_packet = | |
| 2210 max(time_of_last_received_packet_, last_send_for_timeout_); | |
| 2211 } | |
| 2212 | 2206 |
| 2213 // |delta| can be < 0 as |now| is approximate time but |time_of_last_packet| | 2207 // |delta| can be < 0 as |now| is approximate time but |time_of_last_packet| |
| 2214 // is accurate time. However, this should not change the behavior of | 2208 // is accurate time. However, this should not change the behavior of |
| 2215 // timeout handling. | 2209 // timeout handling. |
| 2216 QuicTime::Delta idle_duration = now.Subtract(time_of_last_packet); | 2210 QuicTime::Delta idle_duration = now.Subtract(time_of_last_packet); |
| 2217 DVLOG(1) << ENDPOINT << "last packet " | 2211 DVLOG(1) << ENDPOINT << "last packet " |
| 2218 << time_of_last_packet.ToDebuggingValue() | 2212 << time_of_last_packet.ToDebuggingValue() |
| 2219 << " now:" << now.ToDebuggingValue() | 2213 << " now:" << now.ToDebuggingValue() |
| 2220 << " idle_duration:" << idle_duration.ToMicroseconds() | 2214 << " idle_duration:" << idle_duration.ToMicroseconds() |
| 2221 << " idle_network_timeout: " | 2215 << " idle_network_timeout: " |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2513 void QuicConnection::OnPathClosed(QuicPathId path_id) { | 2507 void QuicConnection::OnPathClosed(QuicPathId path_id) { |
| 2514 // Stop receiving packets on this path. | 2508 // Stop receiving packets on this path. |
| 2515 framer_.OnPathClosed(path_id); | 2509 framer_.OnPathClosed(path_id); |
| 2516 } | 2510 } |
| 2517 | 2511 |
| 2518 bool QuicConnection::ack_frame_updated() const { | 2512 bool QuicConnection::ack_frame_updated() const { |
| 2519 return received_packet_manager_.ack_frame_updated(); | 2513 return received_packet_manager_.ack_frame_updated(); |
| 2520 } | 2514 } |
| 2521 | 2515 |
| 2522 } // namespace net | 2516 } // namespace net |
| OLD | NEW |