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

Side by Side Diff: net/quic/quic_unacked_packet_map.h

Issue 283693002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
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
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
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 24 matching lines...) Expand all
113 106
114 // Returns the number of unacked packets. 107 // Returns the number of unacked packets.
115 size_t GetNumUnackedPackets() const; 108 size_t GetNumUnackedPackets() const;
116 109
117 // Returns true if there are multiple packet pending. 110 // Returns true if there are multiple packet pending.
118 bool HasMultiplePendingPackets() const; 111 bool HasMultiplePendingPackets() const;
119 112
120 // Returns true if there are any pending crypto packets. 113 // Returns true if there are any pending crypto packets.
121 bool HasPendingCryptoPackets() const; 114 bool HasPendingCryptoPackets() const;
122 115
123 // Deletes the retransmittable frames associated with the packet and removes 116 // Removes entries from the unacked packet map, and deletes
124 // it from unacked packets if it's not pending. 117 // the retransmittable frames associated with the packet.
125 // Does not remove any previous or subsequent transmissions of this packet. 118 // Does not remove any previous or subsequent transmissions of this packet.
126 void NeuterIfPendingOrRemovePacket(QuicPacketSequenceNumber sequence_number); 119 void RemovePacket(QuicPacketSequenceNumber sequence_number);
120
121 // Neuters the specified packet. Deletes any retransmittable
122 // frames, and sets all_transmissions to only include itself.
wtc 2014/05/13 18:49:23 1. Unless we expect readers of this code to know a
ramant (doing other things) 2014/05/14 05:33:29 ianswett@: Would like to work with you to make thi
123 void NeuterPacket(QuicPacketSequenceNumber sequence_number);
127 124
128 // Returns true if the packet has been marked as sent by SetSent. 125 // Returns true if the packet has been marked as sent by SetSent.
129 static bool IsSentAndNotPending(const TransmissionInfo& transmission_info); 126 static bool IsSentAndNotPending(const TransmissionInfo& transmission_info);
130 127
131 private: 128 private:
129 void MaybeRemoveRetransmittableFrames(TransmissionInfo* transmission_info);
130
132 QuicPacketSequenceNumber largest_sent_packet_; 131 QuicPacketSequenceNumber largest_sent_packet_;
133 132
134 // Newly serialized retransmittable and fec packets are added to this map, 133 // Newly serialized retransmittable and fec packets are added to this map,
135 // which contains owning pointers to any contained frames. If a packet is 134 // which contains owning pointers to any contained frames. If a packet is
136 // retransmitted, this map will contain entries for both the old and the new 135 // retransmitted, this map will contain entries for both the old and the new
137 // packet. The old packet's retransmittable frames entry will be NULL, while 136 // packet. The old packet's retransmittable frames entry will be NULL, while
138 // the new packet's entry will contain the frames to retransmit. 137 // the new packet's entry will contain the frames to retransmit.
139 // If the old packet is acked before the new packet, then the old entry will 138 // If the old packet is acked before the new packet, then the old entry will
140 // be removed from the map and the new entry's retransmittable frames will be 139 // be removed from the map and the new entry's retransmittable frames will be
141 // set to NULL. 140 // set to NULL.
142 UnackedPacketMap unacked_packets_; 141 UnackedPacketMap unacked_packets_;
143 142
144 size_t bytes_in_flight_; 143 size_t bytes_in_flight_;
145 // Number of outstanding crypto handshake packets. 144 // Number of outstanding crypto handshake packets.
146 size_t pending_crypto_packet_count_; 145 size_t pending_crypto_packet_count_;
147 146
148 DISALLOW_COPY_AND_ASSIGN(QuicUnackedPacketMap); 147 DISALLOW_COPY_AND_ASSIGN(QuicUnackedPacketMap);
149 }; 148 };
150 149
151 } // namespace net 150 } // namespace net
152 151
153 #endif // NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_ 152 #endif // NET_QUIC_QUIC_UNACKED_PACKET_MAP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698