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 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 | 975 |
976 void QuicConnection::MaybeQueueAck() { | 976 void QuicConnection::MaybeQueueAck() { |
977 // If the incoming packet was missing, send an ack immediately. | 977 // If the incoming packet was missing, send an ack immediately. |
978 ack_queued_ = received_packet_manager_.IsMissing( | 978 ack_queued_ = received_packet_manager_.IsMissing( |
979 last_header_.packet_sequence_number); | 979 last_header_.packet_sequence_number); |
980 | 980 |
981 if (!ack_queued_ && ShouldLastPacketInstigateAck()) { | 981 if (!ack_queued_ && ShouldLastPacketInstigateAck()) { |
982 if (ack_alarm_->IsSet()) { | 982 if (ack_alarm_->IsSet()) { |
983 ack_queued_ = true; | 983 ack_queued_ = true; |
984 } else { | 984 } else { |
985 // Send an ack much more quickly for crypto handshake packets. | 985 ack_alarm_->Set( |
986 QuicTime::Delta delayed_ack_time = sent_packet_manager_.DelayedAckTime(); | 986 clock_->ApproximateNow().Add(sent_packet_manager_.DelayedAckTime())); |
987 ack_alarm_->Set(clock_->ApproximateNow().Add(delayed_ack_time)); | |
988 DVLOG(1) << "Ack timer set; next packet or timer will trigger ACK."; | 987 DVLOG(1) << "Ack timer set; next packet or timer will trigger ACK."; |
989 } | 988 } |
990 } | 989 } |
991 | 990 |
992 if (ack_queued_) { | 991 if (ack_queued_) { |
993 ack_alarm_->Cancel(); | 992 ack_alarm_->Cancel(); |
994 } | 993 } |
995 } | 994 } |
996 | 995 |
997 void QuicConnection::ClearLastFrames() { | 996 void QuicConnection::ClearLastFrames() { |
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2157 } | 2156 } |
2158 for (const QuicFrame& frame : retransmittable_frames->frames()) { | 2157 for (const QuicFrame& frame : retransmittable_frames->frames()) { |
2159 if (frame.type == CONNECTION_CLOSE_FRAME) { | 2158 if (frame.type == CONNECTION_CLOSE_FRAME) { |
2160 return true; | 2159 return true; |
2161 } | 2160 } |
2162 } | 2161 } |
2163 return false; | 2162 return false; |
2164 } | 2163 } |
2165 | 2164 |
2166 } // namespace net | 2165 } // namespace net |
OLD | NEW |