| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ | 5 #ifndef NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ |
| 6 #define NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ | 6 #define NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ |
| 7 | 7 |
| 8 #include "net/base/linked_hash_map.h" | 8 #include "net/base/linked_hash_map.h" |
| 9 #include "net/quic/quic_protocol.h" | 9 #include "net/quic/quic_protocol.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // Called when a packet is retransmitted with a new sequence number. | 24 // Called when a packet is retransmitted with a new sequence number. |
| 25 // |old_sequence_number| will remain unacked, but will have no | 25 // |old_sequence_number| will remain unacked, but will have no |
| 26 // retransmittable data associated with it. |new_sequence_number| will | 26 // retransmittable data associated with it. |new_sequence_number| will |
| 27 // be both unacked and associated with retransmittable data. | 27 // be both unacked and associated with retransmittable data. |
| 28 void OnRetransmittedPacket(QuicPacketSequenceNumber old_sequence_number, | 28 void OnRetransmittedPacket(QuicPacketSequenceNumber old_sequence_number, |
| 29 QuicPacketSequenceNumber new_sequence_number); | 29 QuicPacketSequenceNumber new_sequence_number); |
| 30 | 30 |
| 31 // Returns true if the packet |sequence_number| is unacked. | 31 // Returns true if the packet |sequence_number| is unacked. |
| 32 bool IsUnacked(QuicPacketSequenceNumber sequence_number) const; | 32 bool IsUnacked(QuicPacketSequenceNumber sequence_number) const; |
| 33 | 33 |
| 34 // Returns true if the packet |sequence_number| is pending. | |
| 35 bool IsPending(QuicPacketSequenceNumber sequence_number) const; | |
| 36 | |
| 37 // Sets the nack count to the max of the current nack count and |min_nacks|. | 34 // Sets the nack count to the max of the current nack count and |min_nacks|. |
| 38 void NackPacket(QuicPacketSequenceNumber sequence_number, | 35 void NackPacket(QuicPacketSequenceNumber sequence_number, |
| 39 size_t min_nacks); | 36 size_t min_nacks); |
| 40 | 37 |
| 41 // Marks |sequence_number| as no longer pending. | 38 // Marks |sequence_number| as no longer pending. |
| 42 void SetNotPending(QuicPacketSequenceNumber sequence_number); | 39 void SetNotPending(QuicPacketSequenceNumber sequence_number); |
| 43 | 40 |
| 44 // Returns true if the unacked packet |sequence_number| has retransmittable | 41 // Returns true if the unacked packet |sequence_number| has retransmittable |
| 45 // frames. This will return false if the packet has been acked, if a | 42 // frames. This will return false if the packet has been acked, if a |
| 46 // previous transmission of this packet was ACK'd, or if this packet has been | 43 // previous transmission of this packet was ACK'd, or if this packet has been |
| (...skipping 18 matching lines...) Expand all Loading... |
| 65 | 62 |
| 66 // Returns the sum of the bytes in all pending packets. | 63 // Returns the sum of the bytes in all pending packets. |
| 67 QuicByteCount bytes_in_flight() const { | 64 QuicByteCount bytes_in_flight() const { |
| 68 return bytes_in_flight_; | 65 return bytes_in_flight_; |
| 69 } | 66 } |
| 70 | 67 |
| 71 // Returns the smallest sequence number of a serialized packet which has not | 68 // Returns the smallest sequence number of a serialized packet which has not |
| 72 // been acked by the peer. If there are no unacked packets, returns 0. | 69 // been acked by the peer. If there are no unacked packets, returns 0. |
| 73 QuicPacketSequenceNumber GetLeastUnackedSentPacket() const; | 70 QuicPacketSequenceNumber GetLeastUnackedSentPacket() const; |
| 74 | 71 |
| 75 // Returns the set of sequence numbers of all unacked packets. | |
| 76 // Test only. | |
| 77 SequenceNumberSet GetUnackedPackets() const; | |
| 78 | |
| 79 // Sets a packet as sent with the sent time |sent_time|. Marks the packet | 72 // Sets a packet as sent with the sent time |sent_time|. Marks the packet |
| 80 // as pending and tracks the |bytes_sent| if |set_pending| is true. | 73 // as pending and tracks the |bytes_sent| if |set_pending| is true. |
| 81 // Packets marked as pending are expected to be marked as missing when they | 74 // Packets marked as pending are expected to be marked as missing when they |
| 82 // don't arrive, indicating the need for retransmission. | 75 // don't arrive, indicating the need for retransmission. |
| 83 void SetSent(QuicPacketSequenceNumber sequence_number, | 76 void SetSent(QuicPacketSequenceNumber sequence_number, |
| 84 QuicTime sent_time, | 77 QuicTime sent_time, |
| 85 QuicByteCount bytes_sent, | 78 QuicByteCount bytes_sent, |
| 86 bool set_pending); | 79 bool set_pending); |
| 87 | 80 |
| 88 // Clears up to |num_to_clear| previous transmissions in order to make room | 81 // Clears up to |num_to_clear| previous transmissions in order to make room |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 size_t bytes_in_flight_; | 137 size_t bytes_in_flight_; |
| 145 // Number of outstanding crypto handshake packets. | 138 // Number of outstanding crypto handshake packets. |
| 146 size_t pending_crypto_packet_count_; | 139 size_t pending_crypto_packet_count_; |
| 147 | 140 |
| 148 DISALLOW_COPY_AND_ASSIGN(QuicUnackedPacketMap); | 141 DISALLOW_COPY_AND_ASSIGN(QuicUnackedPacketMap); |
| 149 }; | 142 }; |
| 150 | 143 |
| 151 } // namespace net | 144 } // namespace net |
| 152 | 145 |
| 153 #endif // NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ | 146 #endif // NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ |
| OLD | NEW |