| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 current_packet_(nullptr), | 204 current_packet_(nullptr), |
| 205 version_manager_(version_manager), | 205 version_manager_(version_manager), |
| 206 framer_(GetSupportedVersions(), | 206 framer_(GetSupportedVersions(), |
| 207 /*unused*/ QuicTime::Zero(), | 207 /*unused*/ QuicTime::Zero(), |
| 208 Perspective::IS_SERVER), | 208 Perspective::IS_SERVER), |
| 209 last_error_(QUIC_NO_ERROR) { | 209 last_error_(QUIC_NO_ERROR) { |
| 210 framer_.set_visitor(this); | 210 framer_.set_visitor(this); |
| 211 } | 211 } |
| 212 | 212 |
| 213 QuicDispatcher::~QuicDispatcher() { | 213 QuicDispatcher::~QuicDispatcher() { |
| 214 STLDeleteValues(&session_map_); | 214 base::STLDeleteValues(&session_map_); |
| 215 STLDeleteElements(&closed_session_list_); | 215 base::STLDeleteElements(&closed_session_list_); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void QuicDispatcher::InitializeWithWriter(QuicPacketWriter* writer) { | 218 void QuicDispatcher::InitializeWithWriter(QuicPacketWriter* writer) { |
| 219 DCHECK(writer_ == nullptr); | 219 DCHECK(writer_ == nullptr); |
| 220 writer_.reset(writer); | 220 writer_.reset(writer); |
| 221 time_wait_list_manager_.reset(CreateQuicTimeWaitListManager()); | 221 time_wait_list_manager_.reset(CreateQuicTimeWaitListManager()); |
| 222 } | 222 } |
| 223 | 223 |
| 224 void QuicDispatcher::ProcessPacket(const IPEndPoint& server_address, | 224 void QuicDispatcher::ProcessPacket(const IPEndPoint& server_address, |
| 225 const IPEndPoint& client_address, | 225 const IPEndPoint& client_address, |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 DCHECK(connection->termination_packets() != nullptr && | 415 DCHECK(connection->termination_packets() != nullptr && |
| 416 !connection->termination_packets()->empty()); | 416 !connection->termination_packets()->empty()); |
| 417 } | 417 } |
| 418 time_wait_list_manager_->AddConnectionIdToTimeWait( | 418 time_wait_list_manager_->AddConnectionIdToTimeWait( |
| 419 it->first, connection->version(), should_close_statelessly, | 419 it->first, connection->version(), should_close_statelessly, |
| 420 connection->termination_packets()); | 420 connection->termination_packets()); |
| 421 session_map_.erase(it); | 421 session_map_.erase(it); |
| 422 } | 422 } |
| 423 | 423 |
| 424 void QuicDispatcher::DeleteSessions() { | 424 void QuicDispatcher::DeleteSessions() { |
| 425 STLDeleteElements(&closed_session_list_); | 425 base::STLDeleteElements(&closed_session_list_); |
| 426 } | 426 } |
| 427 | 427 |
| 428 void QuicDispatcher::OnCanWrite() { | 428 void QuicDispatcher::OnCanWrite() { |
| 429 // The socket is now writable. | 429 // The socket is now writable. |
| 430 writer_->SetWritable(); | 430 writer_->SetWritable(); |
| 431 | 431 |
| 432 // Give all the blocked writers one chance to write, until we're blocked again | 432 // Give all the blocked writers one chance to write, until we're blocked again |
| 433 // or there's no work left. | 433 // or there's no work left. |
| 434 while (!write_blocked_list_.empty() && !writer_->IsWriteBlocked()) { | 434 while (!write_blocked_list_.empty() && !writer_->IsWriteBlocked()) { |
| 435 QuicBlockedWriterInterface* blocked_writer = | 435 QuicBlockedWriterInterface* blocked_writer = |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 | 719 |
| 720 QUIC_BUG << "Rejector has unknown invalid state."; | 720 QUIC_BUG << "Rejector has unknown invalid state."; |
| 721 return kFateDrop; | 721 return kFateDrop; |
| 722 } | 722 } |
| 723 | 723 |
| 724 const QuicVersionVector& QuicDispatcher::GetSupportedVersions() { | 724 const QuicVersionVector& QuicDispatcher::GetSupportedVersions() { |
| 725 return version_manager_->GetSupportedVersions(); | 725 return version_manager_->GetSupportedVersions(); |
| 726 } | 726 } |
| 727 | 727 |
| 728 } // namespace net | 728 } // namespace net |
| OLD | NEW |