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

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

Issue 1048483002: Pass QuicCryptoServerConfig by pointer instead of reference. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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/tools/quic/quic_dispatcher.h ('k') | net/tools/quic/quic_dispatcher_test.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 (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"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 QuicDispatcher::PacketWriterFactoryAdapter::~PacketWriterFactoryAdapter() {} 156 QuicDispatcher::PacketWriterFactoryAdapter::~PacketWriterFactoryAdapter() {}
157 157
158 QuicPacketWriter* QuicDispatcher::PacketWriterFactoryAdapter::Create( 158 QuicPacketWriter* QuicDispatcher::PacketWriterFactoryAdapter::Create(
159 QuicConnection* connection) const { 159 QuicConnection* connection) const {
160 return dispatcher_->packet_writer_factory_->Create( 160 return dispatcher_->packet_writer_factory_->Create(
161 dispatcher_->writer_.get(), 161 dispatcher_->writer_.get(),
162 connection); 162 connection);
163 } 163 }
164 164
165 QuicDispatcher::QuicDispatcher(const QuicConfig& config, 165 QuicDispatcher::QuicDispatcher(const QuicConfig& config,
166 const QuicCryptoServerConfig& crypto_config, 166 const QuicCryptoServerConfig* crypto_config,
167 const QuicVersionVector& supported_versions, 167 const QuicVersionVector& supported_versions,
168 PacketWriterFactory* packet_writer_factory, 168 PacketWriterFactory* packet_writer_factory,
169 QuicConnectionHelperInterface* helper) 169 QuicConnectionHelperInterface* helper)
170 : config_(config), 170 : config_(config),
171 crypto_config_(crypto_config), 171 crypto_config_(crypto_config),
172 helper_(helper), 172 helper_(helper),
173 delete_sessions_alarm_( 173 delete_sessions_alarm_(
174 helper_->CreateAlarm(new DeleteSessionsAlarm(this))), 174 helper_->CreateAlarm(new DeleteSessionsAlarm(this))),
175 packet_writer_factory_(packet_writer_factory), 175 packet_writer_factory_(packet_writer_factory),
176 connection_writer_factory_(this), 176 connection_writer_factory_(this),
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 397 }
398 398
399 QuicServerSession* QuicDispatcher::CreateQuicSession( 399 QuicServerSession* QuicDispatcher::CreateQuicSession(
400 QuicConnectionId connection_id, 400 QuicConnectionId connection_id,
401 const IPEndPoint& server_address, 401 const IPEndPoint& server_address,
402 const IPEndPoint& client_address) { 402 const IPEndPoint& client_address) {
403 // The QuicServerSession takes ownership of |connection| below. 403 // The QuicServerSession takes ownership of |connection| below.
404 QuicConnection* connection = new QuicConnection( 404 QuicConnection* connection = new QuicConnection(
405 connection_id, client_address, helper_.get(), connection_writer_factory_, 405 connection_id, client_address, helper_.get(), connection_writer_factory_,
406 /* owns_writer= */ true, Perspective::IS_SERVER, 406 /* owns_writer= */ true, Perspective::IS_SERVER,
407 crypto_config_.HasProofSource(), supported_versions_); 407 crypto_config_->HasProofSource(), supported_versions_);
408 408
409 QuicServerSession* session = new QuicServerSession(config_, connection, this); 409 QuicServerSession* session = new QuicServerSession(config_, connection, this);
410 session->InitializeSession(&crypto_config_); 410 session->InitializeSession(crypto_config_);
411 return session; 411 return session;
412 } 412 }
413 413
414 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { 414 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() {
415 return new QuicTimeWaitListManager( 415 return new QuicTimeWaitListManager(
416 writer_.get(), this, helper_.get(), supported_versions()); 416 writer_.get(), this, helper_.get(), supported_versions());
417 } 417 }
418 418
419 bool QuicDispatcher::HandlePacketForTimeWait( 419 bool QuicDispatcher::HandlePacketForTimeWait(
420 const QuicPacketPublicHeader& header) { 420 const QuicPacketPublicHeader& header) {
421 if (header.reset_flag) { 421 if (header.reset_flag) {
422 // Public reset packets do not have sequence numbers, so ignore the packet. 422 // Public reset packets do not have sequence numbers, so ignore the packet.
423 return false; 423 return false;
424 } 424 }
425 425
426 // Switch the framer to the correct version, so that the sequence number can 426 // Switch the framer to the correct version, so that the sequence number can
427 // be parsed correctly. 427 // be parsed correctly.
428 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( 428 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId(
429 header.connection_id)); 429 header.connection_id));
430 430
431 // Continue parsing the packet to extract the sequence number. Then 431 // Continue parsing the packet to extract the sequence number. Then
432 // send it to the time wait manager in OnUnathenticatedHeader. 432 // send it to the time wait manager in OnUnathenticatedHeader.
433 return true; 433 return true;
434 } 434 }
435 435
436 } // namespace tools 436 } // namespace tools
437 } // namespace net 437 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_dispatcher.h ('k') | net/tools/quic/quic_dispatcher_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698