OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/quic/quic_dispatcher.h" | 5 #include "net/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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 QuicConnectionHelperInterface* helper) | 163 QuicConnectionHelperInterface* helper) |
164 : config_(config), | 164 : config_(config), |
165 crypto_config_(crypto_config), | 165 crypto_config_(crypto_config), |
166 helper_(helper), | 166 helper_(helper), |
167 delete_sessions_alarm_( | 167 delete_sessions_alarm_( |
168 helper_->CreateAlarm(new DeleteSessionsAlarm(this))), | 168 helper_->CreateAlarm(new DeleteSessionsAlarm(this))), |
169 packet_writer_factory_(packet_writer_factory), | 169 packet_writer_factory_(packet_writer_factory), |
170 connection_writer_factory_(this), | 170 connection_writer_factory_(this), |
171 supported_versions_(supported_versions), | 171 supported_versions_(supported_versions), |
172 current_packet_(nullptr), | 172 current_packet_(nullptr), |
173 framer_(supported_versions, /*unused*/ QuicTime::Zero(), true), | 173 framer_(supported_versions, |
| 174 /*unused*/ QuicTime::Zero(), |
| 175 Perspective::IS_SERVER), |
174 framer_visitor_(new QuicFramerVisitor(this)) { | 176 framer_visitor_(new QuicFramerVisitor(this)) { |
175 framer_.set_visitor(framer_visitor_.get()); | 177 framer_.set_visitor(framer_visitor_.get()); |
176 } | 178 } |
177 | 179 |
178 QuicDispatcher::~QuicDispatcher() { | 180 QuicDispatcher::~QuicDispatcher() { |
179 STLDeleteValues(&session_map_); | 181 STLDeleteValues(&session_map_); |
180 STLDeleteElements(&closed_session_list_); | 182 STLDeleteElements(&closed_session_list_); |
181 } | 183 } |
182 | 184 |
183 void QuicDispatcher::Initialize(QuicServerPacketWriter* writer) { | 185 void QuicDispatcher::Initialize(QuicServerPacketWriter* writer) { |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 DVLOG(1) << "Connection " << connection_id << " removed from time wait list."; | 387 DVLOG(1) << "Connection " << connection_id << " removed from time wait list."; |
386 } | 388 } |
387 | 389 |
388 QuicSession* QuicDispatcher::CreateQuicSession( | 390 QuicSession* QuicDispatcher::CreateQuicSession( |
389 QuicConnectionId connection_id, | 391 QuicConnectionId connection_id, |
390 const IPEndPoint& server_address, | 392 const IPEndPoint& server_address, |
391 const IPEndPoint& client_address) { | 393 const IPEndPoint& client_address) { |
392 // The QuicSession takes ownership of |connection| below. | 394 // The QuicSession takes ownership of |connection| below. |
393 QuicConnection* connection = new QuicConnection( | 395 QuicConnection* connection = new QuicConnection( |
394 connection_id, client_address, helper_, connection_writer_factory_, | 396 connection_id, client_address, helper_, connection_writer_factory_, |
395 /* owns_writer= */ true, /* is_server= */ true, | 397 /* owns_writer= */ true, Perspective::IS_SERVER, |
396 crypto_config_.HasProofSource(), supported_versions_); | 398 crypto_config_.HasProofSource(), supported_versions_); |
397 | 399 |
398 QuicServerSession* session = new QuicServerSession(config_, connection, this); | 400 QuicServerSession* session = new QuicServerSession(config_, connection, this); |
399 session->InitializeSession(crypto_config_); | 401 session->InitializeSession(crypto_config_); |
400 return session; | 402 return session; |
401 } | 403 } |
402 | 404 |
403 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { | 405 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { |
404 return new QuicTimeWaitListManager( | 406 return new QuicTimeWaitListManager( |
405 writer_.get(), this, helper_, supported_versions()); | 407 writer_.get(), this, helper_, supported_versions()); |
(...skipping 10 matching lines...) Expand all Loading... |
416 // be parsed correctly. | 418 // be parsed correctly. |
417 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( | 419 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( |
418 header.connection_id)); | 420 header.connection_id)); |
419 | 421 |
420 // Continue parsing the packet to extract the sequence number. Then | 422 // Continue parsing the packet to extract the sequence number. Then |
421 // send it to the time wait manager in OnUnathenticatedHeader. | 423 // send it to the time wait manager in OnUnathenticatedHeader. |
422 return true; | 424 return true; |
423 } | 425 } |
424 | 426 |
425 } // namespace net | 427 } // namespace net |
OLD | NEW |