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

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

Issue 2359503003: Landing Recent QUIC changes until 9:58 AM, Sep 17, 2016 UTC (Closed)
Patch Set: Reverted flag flip. Created 4 years, 3 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 (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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_buffered_packet_store.h" 5 #include "net/quic/core/quic_buffered_packet_store.h"
6 6
7 #include <list> 7 #include <list>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "net/quic/core/quic_bug_tracker.h" 10 #include "net/quic/core/quic_bug_tracker.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 QuicConnectionId connection_id) { 149 QuicConnectionId connection_id) {
150 list<BufferedPacket> packets_to_deliver; 150 list<BufferedPacket> packets_to_deliver;
151 auto it = undecryptable_packets_.find(connection_id); 151 auto it = undecryptable_packets_.find(connection_id);
152 if (it != undecryptable_packets_.end()) { 152 if (it != undecryptable_packets_.end()) {
153 packets_to_deliver = std::move(it->second.buffered_packets); 153 packets_to_deliver = std::move(it->second.buffered_packets);
154 undecryptable_packets_.erase(connection_id); 154 undecryptable_packets_.erase(connection_id);
155 } 155 }
156 return packets_to_deliver; 156 return packets_to_deliver;
157 } 157 }
158 158
159 void QuicBufferedPacketStore::DiscardPackets(QuicConnectionId connection_id) {
160 undecryptable_packets_.erase(connection_id);
161 connections_with_chlo_.erase(connection_id);
162 }
163
159 void QuicBufferedPacketStore::OnExpirationTimeout() { 164 void QuicBufferedPacketStore::OnExpirationTimeout() {
160 QuicTime expiration_time = clock_->ApproximateNow() - connection_life_span_; 165 QuicTime expiration_time = clock_->ApproximateNow() - connection_life_span_;
161 while (!undecryptable_packets_.empty()) { 166 while (!undecryptable_packets_.empty()) {
162 auto& entry = undecryptable_packets_.front(); 167 auto& entry = undecryptable_packets_.front();
163 if (entry.second.creation_time > expiration_time) { 168 if (entry.second.creation_time > expiration_time) {
164 break; 169 break;
165 } 170 }
166 QuicConnectionId connection_id = entry.first; 171 QuicConnectionId connection_id = entry.first;
167 visitor_->OnExpiredPackets(connection_id, std::move(entry.second)); 172 visitor_->OnExpiredPackets(connection_id, std::move(entry.second));
168 undecryptable_packets_.erase(undecryptable_packets_.begin()); 173 undecryptable_packets_.erase(undecryptable_packets_.begin());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 DCHECK(!packets.empty()) << "Try to deliver connectons without CHLO"; 214 DCHECK(!packets.empty()) << "Try to deliver connectons without CHLO";
210 return packets; 215 return packets;
211 } 216 }
212 217
213 bool QuicBufferedPacketStore::HasChloForConnection( 218 bool QuicBufferedPacketStore::HasChloForConnection(
214 QuicConnectionId connection_id) { 219 QuicConnectionId connection_id) {
215 return base::ContainsKey(connections_with_chlo_, connection_id); 220 return base::ContainsKey(connections_with_chlo_, connection_id);
216 } 221 }
217 222
218 } // namespace net 223 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_buffered_packet_store.h ('k') | net/quic/core/quic_buffered_packet_store_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698