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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // This will likely have to be tuned. | 54 // This will likely have to be tuned. |
55 const QuicPacketSequenceNumber kMaxPacketGap = 5000; | 55 const QuicPacketSequenceNumber kMaxPacketGap = 5000; |
56 | 56 |
57 // Limit the number of FEC groups to two. If we get enough out of order packets | 57 // Limit the number of FEC groups to two. If we get enough out of order packets |
58 // that this becomes limiting, we can revisit. | 58 // that this becomes limiting, we can revisit. |
59 const size_t kMaxFecGroups = 2; | 59 const size_t kMaxFecGroups = 2; |
60 | 60 |
61 // Maximum number of acks received before sending an ack in response. | 61 // Maximum number of acks received before sending an ack in response. |
62 const QuicPacketCount kMaxPacketsReceivedBeforeAckSend = 20; | 62 const QuicPacketCount kMaxPacketsReceivedBeforeAckSend = 20; |
63 | 63 |
| 64 // Maximum number of tracked packets. |
| 65 const QuicPacketCount kMaxTrackedPackets = 5 * kMaxTcpCongestionWindow; |
| 66 |
64 bool Near(QuicPacketSequenceNumber a, QuicPacketSequenceNumber b) { | 67 bool Near(QuicPacketSequenceNumber a, QuicPacketSequenceNumber b) { |
65 QuicPacketSequenceNumber delta = (a > b) ? a - b : b - a; | 68 QuicPacketSequenceNumber delta = (a > b) ? a - b : b - a; |
66 return delta <= kMaxPacketGap; | 69 return delta <= kMaxPacketGap; |
67 } | 70 } |
68 | 71 |
69 // An alarm that is scheduled to send an ack if a timeout occurs. | 72 // An alarm that is scheduled to send an ack if a timeout occurs. |
70 class AckAlarm : public QuicAlarm::Delegate { | 73 class AckAlarm : public QuicAlarm::Delegate { |
71 public: | 74 public: |
72 explicit AckAlarm(QuicConnection* connection) | 75 explicit AckAlarm(QuicConnection* connection) |
73 : connection_(connection) { | 76 : connection_(connection) { |
(...skipping 2018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2092 } | 2095 } |
2093 for (const QuicFrame& frame : retransmittable_frames->frames()) { | 2096 for (const QuicFrame& frame : retransmittable_frames->frames()) { |
2094 if (frame.type == CONNECTION_CLOSE_FRAME) { | 2097 if (frame.type == CONNECTION_CLOSE_FRAME) { |
2095 return true; | 2098 return true; |
2096 } | 2099 } |
2097 } | 2100 } |
2098 return false; | 2101 return false; |
2099 } | 2102 } |
2100 | 2103 |
2101 } // namespace net | 2104 } // namespace net |
OLD | NEW |