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

Side by Side Diff: net/tools/quic/quic_dispatcher.cc

Issue 1417033008: Remove FLAGS_quic_session_map_threshold_for_stateless_rejects, and instead always use stateless rej… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@106593539
Patch Set: Created 5 years, 1 month 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/tools/quic/quic_dispatcher.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/tools/quic/quic_dispatcher.h" 5 #include "net/tools/quic/quic_dispatcher.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/debug/stack_trace.h" 9 #include "base/debug/stack_trace.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "net/quic/quic_flags.h" 12 #include "net/quic/quic_flags.h"
13 #include "net/quic/quic_utils.h" 13 #include "net/quic/quic_utils.h"
14 #include "net/tools/quic/quic_per_connection_packet_writer.h" 14 #include "net/tools/quic/quic_per_connection_packet_writer.h"
15 #include "net/tools/quic/quic_time_wait_list_manager.h" 15 #include "net/tools/quic/quic_time_wait_list_manager.h"
16 16
17 namespace net { 17 namespace net {
18 18
19 namespace tools { 19 namespace tools {
20 20
21 using std::make_pair; 21 using std::make_pair;
22 using base::StringPiece; 22 using base::StringPiece;
23 23
24 // The threshold size for the session map, over which the dispatcher will start
25 // sending stateless rejects (SREJ), rather than stateful rejects (REJ) to
26 // clients who support them. If -1, stateless rejects will not be sent. If 0,
27 // the server will only send stateless rejects to clients who support them.
28 int32 FLAGS_quic_session_map_threshold_for_stateless_rejects = -1;
29
30 namespace { 24 namespace {
31 25
32 // An alarm that informs the QuicDispatcher to delete old sessions. 26 // An alarm that informs the QuicDispatcher to delete old sessions.
33 class DeleteSessionsAlarm : public QuicAlarm::Delegate { 27 class DeleteSessionsAlarm : public QuicAlarm::Delegate {
34 public: 28 public:
35 explicit DeleteSessionsAlarm(QuicDispatcher* dispatcher) 29 explicit DeleteSessionsAlarm(QuicDispatcher* dispatcher)
36 : dispatcher_(dispatcher) { 30 : dispatcher_(dispatcher) {
37 } 31 }
38 32
39 QuicTime OnAlarm() override { 33 QuicTime OnAlarm() override {
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } 285 }
292 286
293 // Packet's connection ID is unknown. 287 // Packet's connection ID is unknown.
294 // Apply the validity checks. 288 // Apply the validity checks.
295 QuicPacketFate fate = ValidityChecks(header); 289 QuicPacketFate fate = ValidityChecks(header);
296 switch (fate) { 290 switch (fate) {
297 case kFateProcess: { 291 case kFateProcess: {
298 // Create a session and process the packet. 292 // Create a session and process the packet.
299 QuicServerSession* session = 293 QuicServerSession* session =
300 CreateQuicSession(connection_id, current_client_address_); 294 CreateQuicSession(connection_id, current_client_address_);
295 if (FLAGS_enable_quic_stateless_reject_support) {
296 session->set_use_stateless_rejects_if_peer_supported(true);
297 }
301 DVLOG(1) << "Created new session for " << connection_id; 298 DVLOG(1) << "Created new session for " << connection_id;
302 session_map_.insert(std::make_pair(connection_id, session)); 299 session_map_.insert(std::make_pair(connection_id, session));
303 session->connection()->ProcessUdpPacket( 300 session->connection()->ProcessUdpPacket(
304 current_server_address_, current_client_address_, *current_packet_); 301 current_server_address_, current_client_address_, *current_packet_);
305 break; 302 break;
306 } 303 }
307 case kFateTimeWait: 304 case kFateTimeWait:
308 // Add this connection_id to the time-wait state, to safely reject 305 // Add this connection_id to the time-wait state, to safely reject
309 // future packets. 306 // future packets.
310 DVLOG(1) << "Adding connection ID " << connection_id 307 DVLOG(1) << "Adding connection ID " << connection_id
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 QuicConnectionId connection_id, 452 QuicConnectionId connection_id,
456 const IPEndPoint& client_address) { 453 const IPEndPoint& client_address) {
457 // The QuicServerSession takes ownership of |connection| below. 454 // The QuicServerSession takes ownership of |connection| below.
458 QuicConnection* connection = new QuicConnection( 455 QuicConnection* connection = new QuicConnection(
459 connection_id, client_address, helper_.get(), connection_writer_factory_, 456 connection_id, client_address, helper_.get(), connection_writer_factory_,
460 /* owns_writer= */ true, Perspective::IS_SERVER, supported_versions_); 457 /* owns_writer= */ true, Perspective::IS_SERVER, supported_versions_);
461 458
462 QuicServerSession* session = 459 QuicServerSession* session =
463 new QuicServerSession(config_, connection, this, crypto_config_); 460 new QuicServerSession(config_, connection, this, crypto_config_);
464 session->Initialize(); 461 session->Initialize();
465 if (FLAGS_quic_session_map_threshold_for_stateless_rejects != -1 &&
466 session_map_.size() >=
467 static_cast<size_t>(
468 FLAGS_quic_session_map_threshold_for_stateless_rejects)) {
469 session->set_use_stateless_rejects_if_peer_supported(true);
470 }
471 return session; 462 return session;
472 } 463 }
473 464
474 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { 465 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() {
475 // TODO(rjshade): The QuicTimeWaitListManager should take ownership of the 466 // TODO(rjshade): The QuicTimeWaitListManager should take ownership of the
476 // per-connection packet writer. 467 // per-connection packet writer.
477 time_wait_list_writer_.reset( 468 time_wait_list_writer_.reset(
478 packet_writer_factory_->Create(writer_.get(), nullptr)); 469 packet_writer_factory_->Create(writer_.get(), nullptr));
479 return new QuicTimeWaitListManager(time_wait_list_writer_.get(), this, 470 return new QuicTimeWaitListManager(time_wait_list_writer_.get(), this,
480 helper_.get()); 471 helper_.get());
(...skipping 15 matching lines...) Expand all
496 // send it to the time wait manager in OnUnathenticatedHeader. 487 // send it to the time wait manager in OnUnathenticatedHeader.
497 return true; 488 return true;
498 } 489 }
499 490
500 void QuicDispatcher::SetLastError(QuicErrorCode error) { 491 void QuicDispatcher::SetLastError(QuicErrorCode error) {
501 last_error_ = error; 492 last_error_ = error;
502 } 493 }
503 494
504 } // namespace tools 495 } // namespace tools
505 } // namespace net 496 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_dispatcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698