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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 | 354 |
355 void QuicDispatcher::OnConnectionRemovedFromTimeWaitList( | 355 void QuicDispatcher::OnConnectionRemovedFromTimeWaitList( |
356 QuicConnectionId connection_id) { | 356 QuicConnectionId connection_id) { |
357 DVLOG(1) << "Connection " << connection_id << " removed from time wait list."; | 357 DVLOG(1) << "Connection " << connection_id << " removed from time wait list."; |
358 } | 358 } |
359 | 359 |
360 QuicSession* QuicDispatcher::CreateQuicSession( | 360 QuicSession* QuicDispatcher::CreateQuicSession( |
361 QuicConnectionId connection_id, | 361 QuicConnectionId connection_id, |
362 const IPEndPoint& server_address, | 362 const IPEndPoint& server_address, |
363 const IPEndPoint& client_address) { | 363 const IPEndPoint& client_address) { |
364 QuicServerSession* session = new QuicServerSession( | 364 // The QuicSession takes ownership of |connection| below. |
365 config_, | 365 QuicConnection* connection = new QuicConnection( |
366 CreateQuicConnection(connection_id, server_address, client_address), | 366 connection_id, client_address, helper_, connection_writer_factory_, |
367 this); | 367 /* owns_writer= */ true, /* is_server= */ true, |
| 368 crypto_config_.HasProofSource(), supported_versions_); |
| 369 |
| 370 QuicServerSession* session = new QuicServerSession(config_, connection, this); |
368 session->InitializeSession(crypto_config_); | 371 session->InitializeSession(crypto_config_); |
369 return session; | 372 return session; |
370 } | 373 } |
371 | 374 |
372 QuicConnection* QuicDispatcher::CreateQuicConnection( | |
373 QuicConnectionId connection_id, | |
374 const IPEndPoint& server_address, | |
375 const IPEndPoint& client_address) { | |
376 return new QuicConnection(connection_id, | |
377 client_address, | |
378 helper_, | |
379 connection_writer_factory_, | |
380 /* owns_writer= */ true, | |
381 /* is_server= */ true, | |
382 crypto_config_.HasProofSource(), | |
383 supported_versions_); | |
384 } | |
385 | |
386 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { | 375 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { |
387 return new QuicTimeWaitListManager( | 376 return new QuicTimeWaitListManager( |
388 writer_.get(), this, helper_, supported_versions()); | 377 writer_.get(), this, helper_, supported_versions()); |
389 } | 378 } |
390 | 379 |
391 bool QuicDispatcher::HandlePacketForTimeWait( | 380 bool QuicDispatcher::HandlePacketForTimeWait( |
392 const QuicPacketPublicHeader& header) { | 381 const QuicPacketPublicHeader& header) { |
393 if (header.reset_flag) { | 382 if (header.reset_flag) { |
394 // Public reset packets do not have sequence numbers, so ignore the packet. | 383 // Public reset packets do not have sequence numbers, so ignore the packet. |
395 return false; | 384 return false; |
396 } | 385 } |
397 | 386 |
398 // Switch the framer to the correct version, so that the sequence number can | 387 // Switch the framer to the correct version, so that the sequence number can |
399 // be parsed correctly. | 388 // be parsed correctly. |
400 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( | 389 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( |
401 header.connection_id)); | 390 header.connection_id)); |
402 | 391 |
403 // Continue parsing the packet to extract the sequence number. Then | 392 // Continue parsing the packet to extract the sequence number. Then |
404 // send it to the time wait manager in OnUnathenticatedHeader. | 393 // send it to the time wait manager in OnUnathenticatedHeader. |
405 return true; | 394 return true; |
406 } | 395 } |
407 | 396 |
408 } // namespace net | 397 } // namespace net |
OLD | NEW |