OLD | NEW |
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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 connection_id, client_address, helper_.get(), CreatePerConnectionWriter(), | 436 connection_id, client_address, helper_.get(), CreatePerConnectionWriter(), |
437 /* owns_writer= */ true, Perspective::IS_SERVER, supported_versions_); | 437 /* owns_writer= */ true, Perspective::IS_SERVER, supported_versions_); |
438 | 438 |
439 QuicServerSessionBase* session = | 439 QuicServerSessionBase* session = |
440 new QuicSimpleServerSession(config_, connection, this, crypto_config_); | 440 new QuicSimpleServerSession(config_, connection, this, crypto_config_); |
441 session->Initialize(); | 441 session->Initialize(); |
442 return session; | 442 return session; |
443 } | 443 } |
444 | 444 |
445 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { | 445 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { |
446 if (FLAGS_quic_time_wait_list_manager_use_shared_writer) { | 446 return new QuicTimeWaitListManager(writer_.get(), this, helper_.get()); |
447 return new QuicTimeWaitListManager(writer_.get(), this, helper_.get()); | |
448 } else { | |
449 time_wait_list_writer_.reset(CreatePerConnectionWriter()); | |
450 return new QuicTimeWaitListManager(time_wait_list_writer_.get(), this, | |
451 helper_.get()); | |
452 } | |
453 } | 447 } |
454 | 448 |
455 bool QuicDispatcher::HandlePacketForTimeWait( | 449 bool QuicDispatcher::HandlePacketForTimeWait( |
456 const QuicPacketPublicHeader& header) { | 450 const QuicPacketPublicHeader& header) { |
457 if (header.reset_flag) { | 451 if (header.reset_flag) { |
458 // Public reset packets do not have packet numbers, so ignore the packet. | 452 // Public reset packets do not have packet numbers, so ignore the packet. |
459 return false; | 453 return false; |
460 } | 454 } |
461 | 455 |
462 // Switch the framer to the correct version, so that the packet number can | 456 // Switch the framer to the correct version, so that the packet number can |
463 // be parsed correctly. | 457 // be parsed correctly. |
464 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( | 458 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( |
465 header.connection_id)); | 459 header.connection_id)); |
466 | 460 |
467 // Continue parsing the packet to extract the packet number. Then | 461 // Continue parsing the packet to extract the packet number. Then |
468 // send it to the time wait manager in OnUnathenticatedHeader. | 462 // send it to the time wait manager in OnUnathenticatedHeader. |
469 return true; | 463 return true; |
470 } | 464 } |
471 | 465 |
472 QuicPacketWriter* QuicDispatcher::CreatePerConnectionWriter() { | 466 QuicPacketWriter* QuicDispatcher::CreatePerConnectionWriter() { |
473 return new QuicPerConnectionPacketWriter(writer_.get()); | 467 return new QuicPerConnectionPacketWriter(writer_.get()); |
474 } | 468 } |
475 | 469 |
476 void QuicDispatcher::SetLastError(QuicErrorCode error) { | 470 void QuicDispatcher::SetLastError(QuicErrorCode error) { |
477 last_error_ = error; | 471 last_error_ = error; |
478 } | 472 } |
479 | 473 |
480 } // namespace net | 474 } // namespace net |
OLD | NEW |