OLD | NEW |
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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 auto& entry = undecryptable_packets_.front(); | 167 auto& entry = undecryptable_packets_.front(); |
168 if (entry.second.creation_time > expiration_time) { | 168 if (entry.second.creation_time > expiration_time) { |
169 break; | 169 break; |
170 } | 170 } |
171 QuicConnectionId connection_id = entry.first; | 171 QuicConnectionId connection_id = entry.first; |
172 visitor_->OnExpiredPackets(connection_id, std::move(entry.second)); | 172 visitor_->OnExpiredPackets(connection_id, std::move(entry.second)); |
173 undecryptable_packets_.erase(undecryptable_packets_.begin()); | 173 undecryptable_packets_.erase(undecryptable_packets_.begin()); |
174 connections_with_chlo_.erase(connection_id); | 174 connections_with_chlo_.erase(connection_id); |
175 } | 175 } |
176 if (!undecryptable_packets_.empty()) { | 176 if (!undecryptable_packets_.empty()) { |
177 expiration_alarm_->Set(clock_->ApproximateNow() + connection_life_span_); | 177 MaybeSetExpirationAlarm(); |
178 } | 178 } |
179 } | 179 } |
180 | 180 |
181 void QuicBufferedPacketStore::MaybeSetExpirationAlarm() { | 181 void QuicBufferedPacketStore::MaybeSetExpirationAlarm() { |
182 if (!expiration_alarm_->IsSet()) { | 182 if (!expiration_alarm_->IsSet()) { |
183 expiration_alarm_->Set(clock_->ApproximateNow() + connection_life_span_); | 183 expiration_alarm_->Set(clock_->ApproximateNow() + connection_life_span_); |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 bool QuicBufferedPacketStore::ShouldBufferPacket(bool is_chlo) { | 187 bool QuicBufferedPacketStore::ShouldBufferPacket(bool is_chlo) { |
(...skipping 26 matching lines...) Expand all Loading... |
214 DCHECK(!packets.empty()) << "Try to deliver connectons without CHLO"; | 214 DCHECK(!packets.empty()) << "Try to deliver connectons without CHLO"; |
215 return packets; | 215 return packets; |
216 } | 216 } |
217 | 217 |
218 bool QuicBufferedPacketStore::HasChloForConnection( | 218 bool QuicBufferedPacketStore::HasChloForConnection( |
219 QuicConnectionId connection_id) { | 219 QuicConnectionId connection_id) { |
220 return base::ContainsKey(connections_with_chlo_, connection_id); | 220 return base::ContainsKey(connections_with_chlo_, connection_id); |
221 } | 221 } |
222 | 222 |
223 } // namespace net | 223 } // namespace net |
OLD | NEW |