| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // Otherwise fills in feedback and returns true. | 124 // Otherwise fills in feedback and returns true. |
| 125 virtual bool GenerateCongestionFeedback( | 125 virtual bool GenerateCongestionFeedback( |
| 126 QuicCongestionFeedbackFrame* feedback); | 126 QuicCongestionFeedbackFrame* feedback); |
| 127 | 127 |
| 128 // QuicReceivedEntropyHashCalculatorInterface | 128 // QuicReceivedEntropyHashCalculatorInterface |
| 129 // Called by QuicFramer, when the outgoing ack gets truncated, to recalculate | 129 // Called by QuicFramer, when the outgoing ack gets truncated, to recalculate |
| 130 // the received entropy hash for the truncated ack frame. | 130 // the received entropy hash for the truncated ack frame. |
| 131 virtual QuicPacketEntropyHash EntropyHash( | 131 virtual QuicPacketEntropyHash EntropyHash( |
| 132 QuicPacketSequenceNumber sequence_number) const OVERRIDE; | 132 QuicPacketSequenceNumber sequence_number) const OVERRIDE; |
| 133 | 133 |
| 134 // Updates internal state based on |ack_frame|. | |
| 135 void UpdatePacketInformationReceivedByPeer(const QuicAckFrame& ack_frame); | |
| 136 // Updates internal state based on |stop_waiting|. | 134 // Updates internal state based on |stop_waiting|. |
| 137 void UpdatePacketInformationSentByPeer( | 135 void UpdatePacketInformationSentByPeer( |
| 138 const QuicStopWaitingFrame& stop_waiting); | 136 const QuicStopWaitingFrame& stop_waiting); |
| 139 | 137 |
| 140 // Returns whether the peer is missing packets. | 138 // Returns whether the peer is missing packets. |
| 141 bool HasMissingPackets(); | 139 bool HasMissingPackets(); |
| 142 | 140 |
| 143 // Returns true when there are new missing packets to be reported within 3 | 141 // Returns true when there are new missing packets to be reported within 3 |
| 144 // packets of the largest observed. | 142 // packets of the largest observed. |
| 145 bool HasNewMissingPackets(); | 143 bool HasNewMissingPackets(); |
| 146 | 144 |
| 147 QuicPacketSequenceNumber peer_largest_observed_packet() { | |
| 148 return peer_largest_observed_packet_; | |
| 149 } | |
| 150 | |
| 151 QuicPacketSequenceNumber least_packet_awaited_by_peer() { | |
| 152 return least_packet_awaited_by_peer_; | |
| 153 } | |
| 154 | |
| 155 QuicPacketSequenceNumber peer_least_packet_awaiting_ack() { | 145 QuicPacketSequenceNumber peer_least_packet_awaiting_ack() { |
| 156 return peer_least_packet_awaiting_ack_; | 146 return peer_least_packet_awaiting_ack_; |
| 157 } | 147 } |
| 158 | 148 |
| 159 private: | 149 private: |
| 160 friend class test::QuicConnectionPeer; | 150 friend class test::QuicConnectionPeer; |
| 161 friend class test::QuicReceivedPacketManagerPeer; | 151 friend class test::QuicReceivedPacketManagerPeer; |
| 162 | 152 |
| 163 // Deletes all missing packets before least unacked. The connection won't | 153 // Deletes all missing packets before least unacked. The connection won't |
| 164 // process any packets with sequence number before |least_unacked| that it | 154 // process any packets with sequence number before |least_unacked| that it |
| 165 // received after this call. Returns true if there were missing packets before | 155 // received after this call. Returns true if there were missing packets before |
| 166 // |least_unacked| unacked, false otherwise. | 156 // |least_unacked| unacked, false otherwise. |
| 167 bool DontWaitForPacketsBefore(QuicPacketSequenceNumber least_unacked); | 157 bool DontWaitForPacketsBefore(QuicPacketSequenceNumber least_unacked); |
| 168 | 158 |
| 169 // Tracks entropy hashes of received packets. | 159 // Tracks entropy hashes of received packets. |
| 170 EntropyTracker entropy_tracker_; | 160 EntropyTracker entropy_tracker_; |
| 171 | 161 |
| 172 // Track some peer state so we can do less bookkeeping. | |
| 173 // Largest sequence number that the peer has observed. Mostly received, | |
| 174 // missing in case of truncated acks. | |
| 175 QuicPacketSequenceNumber peer_largest_observed_packet_; | |
| 176 // Least sequence number which the peer is still waiting for. | |
| 177 QuicPacketSequenceNumber least_packet_awaited_by_peer_; | |
| 178 // Least sequence number of the the packet sent by the peer for which it | 162 // Least sequence number of the the packet sent by the peer for which it |
| 179 // hasn't received an ack. | 163 // hasn't received an ack. |
| 180 QuicPacketSequenceNumber peer_least_packet_awaiting_ack_; | 164 QuicPacketSequenceNumber peer_least_packet_awaiting_ack_; |
| 181 | 165 |
| 182 // Received packet information used to produce acks. | 166 // Received packet information used to produce acks. |
| 183 QuicAckFrame ack_frame_; | 167 QuicAckFrame ack_frame_; |
| 184 | 168 |
| 185 // The time we received the largest_observed sequence number, or zero if | 169 // The time we received the largest_observed sequence number, or zero if |
| 186 // no sequence numbers have been received since UpdateReceivedPacketInfo. | 170 // no sequence numbers have been received since UpdateReceivedPacketInfo. |
| 187 // Needed for calculating delta_time_largest_observed. | 171 // Needed for calculating delta_time_largest_observed. |
| 188 QuicTime time_largest_observed_; | 172 QuicTime time_largest_observed_; |
| 189 | 173 |
| 190 scoped_ptr<ReceiveAlgorithmInterface> receive_algorithm_; | 174 scoped_ptr<ReceiveAlgorithmInterface> receive_algorithm_; |
| 191 | 175 |
| 192 QuicConnectionStats* stats_; | 176 QuicConnectionStats* stats_; |
| 193 | 177 |
| 194 DISALLOW_COPY_AND_ASSIGN(QuicReceivedPacketManager); | 178 DISALLOW_COPY_AND_ASSIGN(QuicReceivedPacketManager); |
| 195 }; | 179 }; |
| 196 | 180 |
| 197 } // namespace net | 181 } // namespace net |
| 198 | 182 |
| 199 #endif // NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ | 183 #endif // NET_QUIC_QUIC_RECEIVED_PACKET_MANAGER_H_ |
| OLD | NEW |