| 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 <errno.h> | 7 #include <errno.h> |
| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 EpollServer* epoll_server) | 167 EpollServer* epoll_server) |
| 168 : config_(config), | 168 : config_(config), |
| 169 crypto_config_(crypto_config), | 169 crypto_config_(crypto_config), |
| 170 delete_sessions_alarm_(new DeleteSessionsAlarm(this)), | 170 delete_sessions_alarm_(new DeleteSessionsAlarm(this)), |
| 171 epoll_server_(epoll_server), | 171 epoll_server_(epoll_server), |
| 172 helper_(new QuicEpollConnectionHelper(epoll_server_)), | 172 helper_(new QuicEpollConnectionHelper(epoll_server_)), |
| 173 packet_writer_factory_(packet_writer_factory), | 173 packet_writer_factory_(packet_writer_factory), |
| 174 connection_writer_factory_(this), | 174 connection_writer_factory_(this), |
| 175 supported_versions_(supported_versions), | 175 supported_versions_(supported_versions), |
| 176 current_packet_(nullptr), | 176 current_packet_(nullptr), |
| 177 framer_(supported_versions, /*unused*/ QuicTime::Zero(), true), | 177 framer_(supported_versions, |
| 178 /*unused*/ QuicTime::Zero(), |
| 179 Perspective::IS_SERVER), |
| 178 framer_visitor_(new QuicFramerVisitor(this)) { | 180 framer_visitor_(new QuicFramerVisitor(this)) { |
| 179 framer_.set_visitor(framer_visitor_.get()); | 181 framer_.set_visitor(framer_visitor_.get()); |
| 180 } | 182 } |
| 181 | 183 |
| 182 QuicDispatcher::~QuicDispatcher() { | 184 QuicDispatcher::~QuicDispatcher() { |
| 183 STLDeleteValues(&session_map_); | 185 STLDeleteValues(&session_map_); |
| 184 STLDeleteElements(&closed_session_list_); | 186 STLDeleteElements(&closed_session_list_); |
| 185 } | 187 } |
| 186 | 188 |
| 187 void QuicDispatcher::Initialize(int fd) { | 189 void QuicDispatcher::Initialize(int fd) { |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 return new QuicDefaultPacketWriter(fd); | 398 return new QuicDefaultPacketWriter(fd); |
| 397 } | 399 } |
| 398 | 400 |
| 399 QuicSession* QuicDispatcher::CreateQuicSession( | 401 QuicSession* QuicDispatcher::CreateQuicSession( |
| 400 QuicConnectionId connection_id, | 402 QuicConnectionId connection_id, |
| 401 const IPEndPoint& server_address, | 403 const IPEndPoint& server_address, |
| 402 const IPEndPoint& client_address) { | 404 const IPEndPoint& client_address) { |
| 403 // The QuicSession takes ownership of |connection| below. | 405 // The QuicSession takes ownership of |connection| below. |
| 404 QuicConnection* connection = new QuicConnection( | 406 QuicConnection* connection = new QuicConnection( |
| 405 connection_id, client_address, helper_.get(), connection_writer_factory_, | 407 connection_id, client_address, helper_.get(), connection_writer_factory_, |
| 406 /* owns_writer= */ true, /* is_server= */ true, | 408 /* owns_writer= */ true, Perspective::IS_SERVER, |
| 407 crypto_config_.HasProofSource(), supported_versions_); | 409 crypto_config_.HasProofSource(), supported_versions_); |
| 408 | 410 |
| 409 QuicServerSession* session = new QuicServerSession(config_, connection, this); | 411 QuicServerSession* session = new QuicServerSession(config_, connection, this); |
| 410 session->InitializeSession(crypto_config_); | 412 session->InitializeSession(crypto_config_); |
| 411 return session; | 413 return session; |
| 412 } | 414 } |
| 413 | 415 |
| 414 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { | 416 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { |
| 415 return new QuicTimeWaitListManager( | 417 return new QuicTimeWaitListManager( |
| 416 writer_.get(), this, epoll_server(), supported_versions()); | 418 writer_.get(), this, epoll_server(), supported_versions()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 428 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( | 430 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( |
| 429 header.connection_id)); | 431 header.connection_id)); |
| 430 | 432 |
| 431 // Continue parsing the packet to extract the sequence number. Then | 433 // Continue parsing the packet to extract the sequence number. Then |
| 432 // send it to the time wait manager in OnUnathenticatedHeader. | 434 // send it to the time wait manager in OnUnathenticatedHeader. |
| 433 return true; | 435 return true; |
| 434 } | 436 } |
| 435 | 437 |
| 436 } // namespace tools | 438 } // namespace tools |
| 437 } // namespace net | 439 } // namespace net |
| OLD | NEW |