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

Side by Side Diff: net/quic/quic_time_wait_list_manager.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 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
« no previous file with comments | « net/quic/quic_stream_sequencer_test.cc ('k') | net/quic/quic_unacked_packet_map.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/quic_time_wait_list_manager.h" 5 #include "net/quic/quic_time_wait_list_manager.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 8
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "net/base/ip_endpoint.h" 12 #include "net/base/ip_endpoint.h"
13 #include "net/quic/crypto/crypto_protocol.h" 13 #include "net/quic/crypto/crypto_protocol.h"
14 #include "net/quic/crypto/quic_decrypter.h" 14 #include "net/quic/crypto/quic_decrypter.h"
15 #include "net/quic/crypto/quic_encrypter.h" 15 #include "net/quic/crypto/quic_encrypter.h"
16 #include "net/quic/quic_clock.h" 16 #include "net/quic/quic_clock.h"
17 #include "net/quic/quic_connection_helper.h" 17 #include "net/quic/quic_connection_helper.h"
18 #include "net/quic/quic_flags.h" 18 #include "net/quic/quic_flags.h"
19 #include "net/quic/quic_framer.h" 19 #include "net/quic/quic_framer.h"
20 #include "net/quic/quic_protocol.h" 20 #include "net/quic/quic_protocol.h"
21 #include "net/quic/quic_server_session.h" 21 #include "net/quic/quic_server_session.h"
22 #include "net/quic/quic_utils.h" 22 #include "net/quic/quic_utils.h"
23 23
24 using base::StringPiece; 24 using base::StringPiece;
25 using std::make_pair;
26 25
27 namespace net { 26 namespace net {
28 27
29 // A very simple alarm that just informs the QuicTimeWaitListManager to clean 28 // A very simple alarm that just informs the QuicTimeWaitListManager to clean
30 // up old connection_ids. This alarm should be unregistered and deleted before 29 // up old connection_ids. This alarm should be unregistered and deleted before
31 // the QuicTimeWaitListManager is deleted. 30 // the QuicTimeWaitListManager is deleted.
32 class ConnectionIdCleanUpAlarm : public QuicAlarm::Delegate { 31 class ConnectionIdCleanUpAlarm : public QuicAlarm::Delegate {
33 public: 32 public:
34 explicit ConnectionIdCleanUpAlarm( 33 explicit ConnectionIdCleanUpAlarm(
35 QuicTimeWaitListManager* time_wait_list_manager) 34 QuicTimeWaitListManager* time_wait_list_manager)
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 114 }
116 TrimTimeWaitListIfNeeded(); 115 TrimTimeWaitListIfNeeded();
117 if (FLAGS_quic_limit_time_wait_list_size) { 116 if (FLAGS_quic_limit_time_wait_list_size) {
118 DCHECK_LT(num_connections(), 117 DCHECK_LT(num_connections(),
119 static_cast<size_t>(FLAGS_quic_time_wait_list_max_connections)); 118 static_cast<size_t>(FLAGS_quic_time_wait_list_max_connections));
120 } 119 }
121 ConnectionIdData data(num_packets, 120 ConnectionIdData data(num_packets,
122 version, 121 version,
123 helper_->GetClock()->ApproximateNow(), 122 helper_->GetClock()->ApproximateNow(),
124 close_packet); 123 close_packet);
125 connection_id_map_.insert(make_pair(connection_id, data)); 124 connection_id_map_.insert(std::make_pair(connection_id, data));
126 if (new_connection_id) { 125 if (new_connection_id) {
127 visitor_->OnConnectionAddedToTimeWaitList(connection_id); 126 visitor_->OnConnectionAddedToTimeWaitList(connection_id);
128 } 127 }
129 } 128 }
130 129
131 bool QuicTimeWaitListManager::IsConnectionIdInTimeWait( 130 bool QuicTimeWaitListManager::IsConnectionIdInTimeWait(
132 QuicConnectionId connection_id) const { 131 QuicConnectionId connection_id) const {
133 return ContainsKey(connection_id_map_, connection_id); 132 return ContainsKey(connection_id_map_, connection_id);
134 } 133 }
135 134
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 return; 318 return;
320 } 319 }
321 while (num_connections() >= 320 while (num_connections() >=
322 static_cast<size_t>(FLAGS_quic_time_wait_list_max_connections)) { 321 static_cast<size_t>(FLAGS_quic_time_wait_list_max_connections)) {
323 MaybeExpireOldestConnection(QuicTime::Infinite()); 322 MaybeExpireOldestConnection(QuicTime::Infinite());
324 } 323 }
325 } 324 }
326 } 325 }
327 326
328 } // namespace net 327 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_stream_sequencer_test.cc ('k') | net/quic/quic_unacked_packet_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698