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

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

Issue 1908103002: Landing Recent QUIC changes until 4/15/2016 17:20 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 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 23 matching lines...) Expand all
34 34
35 private: 35 private:
36 // Not owned. 36 // Not owned.
37 QuicDispatcher* dispatcher_; 37 QuicDispatcher* dispatcher_;
38 38
39 DISALLOW_COPY_AND_ASSIGN(DeleteSessionsAlarm); 39 DISALLOW_COPY_AND_ASSIGN(DeleteSessionsAlarm);
40 }; 40 };
41 41
42 } // namespace 42 } // namespace
43 43
44 QuicDispatcher::QuicDispatcher(const QuicConfig& config, 44 QuicDispatcher::QuicDispatcher(
45 const QuicCryptoServerConfig* crypto_config, 45 const QuicConfig& config,
46 const QuicVersionVector& supported_versions, 46 const QuicCryptoServerConfig* crypto_config,
47 QuicConnectionHelperInterface* helper) 47 const QuicVersionVector& supported_versions,
48 std::unique_ptr<QuicConnectionHelperInterface> helper,
49 std::unique_ptr<QuicAlarmFactory> alarm_factory)
48 : config_(config), 50 : config_(config),
49 crypto_config_(crypto_config), 51 crypto_config_(crypto_config),
50 compressed_certs_cache_( 52 compressed_certs_cache_(
51 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize), 53 QuicCompressedCertsCache::kQuicCompressedCertsCacheSize),
52 helper_(helper), 54 helper_(std::move(helper)),
55 alarm_factory_(std::move(alarm_factory)),
53 delete_sessions_alarm_( 56 delete_sessions_alarm_(
54 helper_->CreateAlarm(new DeleteSessionsAlarm(this))), 57 alarm_factory_->CreateAlarm(new DeleteSessionsAlarm(this))),
55 supported_versions_(supported_versions), 58 supported_versions_(supported_versions),
56 current_packet_(nullptr), 59 current_packet_(nullptr),
57 framer_(supported_versions, 60 framer_(supported_versions,
58 /*unused*/ QuicTime::Zero(), 61 /*unused*/ QuicTime::Zero(),
59 Perspective::IS_SERVER), 62 Perspective::IS_SERVER),
60 last_error_(QUIC_NO_ERROR) { 63 last_error_(QUIC_NO_ERROR) {
61 framer_.set_visitor(this); 64 framer_.set_visitor(this);
62 } 65 }
63 66
64 QuicDispatcher::~QuicDispatcher() { 67 QuicDispatcher::~QuicDispatcher() {
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 445
443 void QuicDispatcher::OnPacketComplete() { 446 void QuicDispatcher::OnPacketComplete() {
444 DCHECK(false); 447 DCHECK(false);
445 } 448 }
446 449
447 QuicServerSessionBase* QuicDispatcher::CreateQuicSession( 450 QuicServerSessionBase* QuicDispatcher::CreateQuicSession(
448 QuicConnectionId connection_id, 451 QuicConnectionId connection_id,
449 const IPEndPoint& client_address) { 452 const IPEndPoint& client_address) {
450 // The QuicServerSessionBase takes ownership of |connection| below. 453 // The QuicServerSessionBase takes ownership of |connection| below.
451 QuicConnection* connection = new QuicConnection( 454 QuicConnection* connection = new QuicConnection(
452 connection_id, client_address, helper_.get(), CreatePerConnectionWriter(), 455 connection_id, client_address, helper_.get(), alarm_factory_.get(),
456 CreatePerConnectionWriter(),
453 /* owns_writer= */ true, Perspective::IS_SERVER, supported_versions_); 457 /* owns_writer= */ true, Perspective::IS_SERVER, supported_versions_);
454 458
455 QuicServerSessionBase* session = new QuicSimpleServerSession( 459 QuicServerSessionBase* session = new QuicSimpleServerSession(
456 config_, connection, this, crypto_config_, &compressed_certs_cache_); 460 config_, connection, this, crypto_config_, &compressed_certs_cache_);
457 session->Initialize(); 461 session->Initialize();
458 return session; 462 return session;
459 } 463 }
460 464
461 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { 465 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() {
462 return new QuicTimeWaitListManager(writer_.get(), this, helper_.get()); 466 return new QuicTimeWaitListManager(writer_.get(), this, helper_.get(),
467 alarm_factory_.get());
463 } 468 }
464 469
465 bool QuicDispatcher::HandlePacketForTimeWait( 470 bool QuicDispatcher::HandlePacketForTimeWait(
466 const QuicPacketPublicHeader& header) { 471 const QuicPacketPublicHeader& header) {
467 if (header.reset_flag) { 472 if (header.reset_flag) {
468 // Public reset packets do not have packet numbers, so ignore the packet. 473 // Public reset packets do not have packet numbers, so ignore the packet.
469 return false; 474 return false;
470 } 475 }
471 476
472 // Switch the framer to the correct version, so that the packet number can 477 // Switch the framer to the correct version, so that the packet number can
473 // be parsed correctly. 478 // be parsed correctly.
474 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( 479 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId(
475 header.connection_id)); 480 header.connection_id));
476 481
477 // Continue parsing the packet to extract the packet number. Then 482 // Continue parsing the packet to extract the packet number. Then
478 // send it to the time wait manager in OnUnathenticatedHeader. 483 // send it to the time wait manager in OnUnathenticatedHeader.
479 return true; 484 return true;
480 } 485 }
481 486
482 QuicPacketWriter* QuicDispatcher::CreatePerConnectionWriter() { 487 QuicPacketWriter* QuicDispatcher::CreatePerConnectionWriter() {
483 return new QuicPerConnectionPacketWriter(writer_.get()); 488 return new QuicPerConnectionPacketWriter(writer_.get());
484 } 489 }
485 490
486 void QuicDispatcher::SetLastError(QuicErrorCode error) { 491 void QuicDispatcher::SetLastError(QuicErrorCode error) {
487 last_error_ = error; 492 last_error_ = error;
488 } 493 }
489 494
490 } // namespace net 495 } // 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