| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Manages the packet entropy calculation for both sent and received packets | 5 // Manages the packet entropy calculation for both sent and received packets |
| 6 // for a connection. | 6 // for a connection. |
| 7 | 7 |
| 8 #ifndef NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ | 8 #ifndef NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ |
| 9 #define NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ | 9 #define NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // sequence_number == first_gap_. | 52 // sequence_number == first_gap_. |
| 53 void RecordPacketEntropyHash(QuicPacketSequenceNumber sequence_number, | 53 void RecordPacketEntropyHash(QuicPacketSequenceNumber sequence_number, |
| 54 QuicPacketEntropyHash entropy_hash); | 54 QuicPacketEntropyHash entropy_hash); |
| 55 | 55 |
| 56 // Sets the entropy hash up to but not including a sequence number based | 56 // Sets the entropy hash up to but not including a sequence number based |
| 57 // on the hash provided by a StopWaiting frame. Clears older packet | 57 // on the hash provided by a StopWaiting frame. Clears older packet |
| 58 // entropy entries and performs garbage collection up to the first gap. | 58 // entropy entries and performs garbage collection up to the first gap. |
| 59 void SetCumulativeEntropyUpTo(QuicPacketSequenceNumber sequence_number, | 59 void SetCumulativeEntropyUpTo(QuicPacketSequenceNumber sequence_number, |
| 60 QuicPacketEntropyHash entropy_hash); | 60 QuicPacketEntropyHash entropy_hash); |
| 61 | 61 |
| 62 size_t size() const { return packets_entropy_.size(); } |
| 63 |
| 62 private: | 64 private: |
| 63 friend class test::EntropyTrackerPeer; | 65 friend class test::EntropyTrackerPeer; |
| 64 | 66 |
| 65 // A deque indexed by sequence number storing the packet's hash and whether | 67 // A deque indexed by sequence number storing the packet's hash and whether |
| 66 // a hash was recorded for that sequence number. | 68 // a hash was recorded for that sequence number. |
| 67 typedef std::deque<std::pair<QuicPacketEntropyHash, bool> > | 69 typedef std::deque<std::pair<QuicPacketEntropyHash, bool> > |
| 68 ReceivedEntropyHashes; | 70 ReceivedEntropyHashes; |
| 69 | 71 |
| 70 // Recomputes first_gap_ and removes packets_entropy_ entries that are no | 72 // Recomputes first_gap_ and removes packets_entropy_ entries that are no |
| 71 // longer needed to compute EntropyHash. | 73 // longer needed to compute EntropyHash. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // the received entropy hash for the truncated ack frame. | 132 // the received entropy hash for the truncated ack frame. |
| 131 QuicPacketEntropyHash EntropyHash( | 133 QuicPacketEntropyHash EntropyHash( |
| 132 QuicPacketSequenceNumber sequence_number) const override; | 134 QuicPacketSequenceNumber sequence_number) const override; |
| 133 | 135 |
| 134 // Updates internal state based on |stop_waiting|. | 136 // Updates internal state based on |stop_waiting|. |
| 135 void UpdatePacketInformationSentByPeer( | 137 void UpdatePacketInformationSentByPeer( |
| 136 const QuicStopWaitingFrame& stop_waiting); | 138 const QuicStopWaitingFrame& stop_waiting); |
| 137 | 139 |
| 138 // Returns true when there are new missing packets to be reported within 3 | 140 // Returns true when there are new missing packets to be reported within 3 |
| 139 // packets of the largest observed. | 141 // packets of the largest observed. |
| 140 bool HasNewMissingPackets(); | 142 bool HasNewMissingPackets() const; |
| 143 |
| 144 // Returns the number of packets being tracked in the EntropyTracker. |
| 145 size_t NumTrackedPackets() const; |
| 141 | 146 |
| 142 QuicPacketSequenceNumber peer_least_packet_awaiting_ack() { | 147 QuicPacketSequenceNumber peer_least_packet_awaiting_ack() { |
| 143 return peer_least_packet_awaiting_ack_; | 148 return peer_least_packet_awaiting_ack_; |
| 144 } | 149 } |
| 145 | 150 |
| 146 private: | 151 private: |
| 147 friend class test::QuicConnectionPeer; | 152 friend class test::QuicConnectionPeer; |
| 148 friend class test::QuicReceivedPacketManagerPeer; | 153 friend class test::QuicReceivedPacketManagerPeer; |
| 149 | 154 |
| 150 // Deletes all missing packets before least unacked. The connection won't | 155 // Deletes all missing packets before least unacked. The connection won't |
| (...skipping 22 matching lines...) Expand all Loading... |
| 173 QuicConnectionStats* stats_; | 178 QuicConnectionStats* stats_; |
| 174 | 179 |
| 175 PacketTimeList received_packet_times_; | 180 PacketTimeList received_packet_times_; |
| 176 | 181 |
| 177 DISALLOW_COPY_AND_ASSIGN(QuicReceivedPacketManager); | 182 DISALLOW_COPY_AND_ASSIGN(QuicReceivedPacketManager); |
| 178 }; | 183 }; |
| 179 | 184 |
| 180 } // namespace net | 185 } // namespace net |
| 181 | 186 |
| 182 #endif // NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ | 187 #endif // NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ |
| OLD | NEW |