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

Side by Side Diff: net/quic/core/quic_received_packet_manager.cc

Issue 2713963003: Simplify QuicReceivedPacketManager by combining DontWaitForPacketsBefore and UpdatePacketInformatio… (Closed)
Patch Set: Created 3 years, 10 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
OLDNEW
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 #include "net/quic/core/quic_received_packet_manager.h" 5 #include "net/quic/core/quic_received_packet_manager.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <utility> 8 #include <utility>
9 9
10 #include "net/quic/core/crypto/crypto_protocol.h" 10 #include "net/quic/core/crypto/crypto_protocol.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 std::numeric_limits<uint8_t>::max()) { 96 std::numeric_limits<uint8_t>::max()) {
97 it = ack_frame_.received_packet_times.erase(it); 97 it = ack_frame_.received_packet_times.erase(it);
98 } else { 98 } else {
99 ++it; 99 ++it;
100 } 100 }
101 } 101 }
102 102
103 return QuicFrame(&ack_frame_); 103 return QuicFrame(&ack_frame_);
104 } 104 }
105 105
106 bool QuicReceivedPacketManager::DontWaitForPacketsBefore( 106 void QuicReceivedPacketManager::DontWaitForPacketsBefore(
107 QuicPacketNumber least_unacked) { 107 QuicPacketNumber least_unacked) {
108 peer_least_packet_awaiting_ack_ = least_unacked;
109 return ack_frame_.packets.RemoveUpTo(least_unacked);
110 }
111
112 void QuicReceivedPacketManager::UpdatePacketInformationSentByPeer(
113 const QuicStopWaitingFrame& stop_waiting) {
114 // ValidateAck() should fail if peer_least_packet_awaiting_ack shrinks. 108 // ValidateAck() should fail if peer_least_packet_awaiting_ack shrinks.
115 DCHECK_LE(peer_least_packet_awaiting_ack_, stop_waiting.least_unacked); 109 DCHECK_LE(peer_least_packet_awaiting_ack_, least_unacked);
116 if (stop_waiting.least_unacked > peer_least_packet_awaiting_ack_) { 110 if (least_unacked > peer_least_packet_awaiting_ack_) {
117 bool packets_updated = DontWaitForPacketsBefore(stop_waiting.least_unacked); 111 peer_least_packet_awaiting_ack_ = least_unacked;
112 bool packets_updated = ack_frame_.packets.RemoveUpTo(least_unacked);
118 if (packets_updated) { 113 if (packets_updated) {
119 // Ack frame gets updated because packets set is updated because of stop 114 // Ack frame gets updated because packets set is updated because of stop
120 // waiting frame. 115 // waiting frame.
121 ack_frame_updated_ = true; 116 ack_frame_updated_ = true;
122 } 117 }
123 } 118 }
124 DCHECK(ack_frame_.packets.Empty() || 119 DCHECK(ack_frame_.packets.Empty() ||
125 ack_frame_.packets.Min() >= peer_least_packet_awaiting_ack_); 120 ack_frame_.packets.Min() >= peer_least_packet_awaiting_ack_);
126 } 121 }
127 122
(...skipping 11 matching lines...) Expand all
139 134
140 bool QuicReceivedPacketManager::ack_frame_updated() const { 135 bool QuicReceivedPacketManager::ack_frame_updated() const {
141 return ack_frame_updated_; 136 return ack_frame_updated_;
142 } 137 }
143 138
144 QuicPacketNumber QuicReceivedPacketManager::GetLargestObserved() const { 139 QuicPacketNumber QuicReceivedPacketManager::GetLargestObserved() const {
145 return ack_frame_.largest_observed; 140 return ack_frame_.largest_observed;
146 } 141 }
147 142
148 } // namespace net 143 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_received_packet_manager.h ('k') | net/quic/core/quic_received_packet_manager_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698