| 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 session->InitializeSession(crypto_config_); | 371 session->InitializeSession(crypto_config_); |
| 372 return session; | 372 return session; |
| 373 } | 373 } |
| 374 | 374 |
| 375 QuicConnection* QuicDispatcher::CreateQuicConnection( | 375 QuicConnection* QuicDispatcher::CreateQuicConnection( |
| 376 QuicConnectionId connection_id, | 376 QuicConnectionId connection_id, |
| 377 const IPEndPoint& server_address, | 377 const IPEndPoint& server_address, |
| 378 const IPEndPoint& client_address) { | 378 const IPEndPoint& client_address) { |
| 379 if (FLAGS_enable_quic_connection_flow_control_2) { | 379 if (FLAGS_enable_quic_connection_flow_control_2) { |
| 380 DLOG(INFO) << "Creating QuicDispatcher with all versions."; | 380 DLOG(INFO) << "Creating QuicDispatcher with all versions."; |
| 381 return new QuicConnection(connection_id, client_address, helper_.get(), | 381 return new QuicConnection(connection_id, |
| 382 writer_.get(), true, supported_versions_); | 382 client_address, |
| 383 helper_.get(), |
| 384 writer_.get(), |
| 385 false /* owns_writer */, |
| 386 true /* is_server */, |
| 387 supported_versions_); |
| 383 } | 388 } |
| 384 | 389 |
| 385 DLOG(INFO) << "Connection flow control disabled, creating QuicDispatcher " | 390 DLOG(INFO) << "Connection flow control disabled, creating QuicDispatcher " |
| 386 << "WITHOUT version 19 or higher."; | 391 << "WITHOUT version 19 or higher."; |
| 387 return new QuicConnection(connection_id, client_address, helper_.get(), | 392 return new QuicConnection(connection_id, |
| 388 writer_.get(), true, | 393 client_address, |
| 394 helper_.get(), |
| 395 writer_.get(), |
| 396 false /* owns_writer */, |
| 397 true /* is_server */, |
| 389 supported_versions_no_connection_flow_control_); | 398 supported_versions_no_connection_flow_control_); |
| 390 } | 399 } |
| 391 | 400 |
| 392 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { | 401 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { |
| 393 return new QuicTimeWaitListManager( | 402 return new QuicTimeWaitListManager( |
| 394 writer_.get(), this, epoll_server(), supported_versions()); | 403 writer_.get(), this, epoll_server(), supported_versions()); |
| 395 } | 404 } |
| 396 | 405 |
| 397 bool QuicDispatcher::HandlePacketForTimeWait( | 406 bool QuicDispatcher::HandlePacketForTimeWait( |
| 398 const QuicPacketPublicHeader& header) { | 407 const QuicPacketPublicHeader& header) { |
| 399 if (header.reset_flag) { | 408 if (header.reset_flag) { |
| 400 // Public reset packets do not have sequence numbers, so ignore the packet. | 409 // Public reset packets do not have sequence numbers, so ignore the packet. |
| 401 return false; | 410 return false; |
| 402 } | 411 } |
| 403 | 412 |
| 404 // Switch the framer to the correct version, so that the sequence number can | 413 // Switch the framer to the correct version, so that the sequence number can |
| 405 // be parsed correctly. | 414 // be parsed correctly. |
| 406 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( | 415 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( |
| 407 header.connection_id)); | 416 header.connection_id)); |
| 408 | 417 |
| 409 // Continue parsing the packet to extract the sequence number. Then | 418 // Continue parsing the packet to extract the sequence number. Then |
| 410 // send it to the time wait manager in OnUnathenticatedHeader. | 419 // send it to the time wait manager in OnUnathenticatedHeader. |
| 411 return true; | 420 return true; |
| 412 } | 421 } |
| 413 | 422 |
| 414 } // namespace tools | 423 } // namespace tools |
| 415 } // namespace net | 424 } // namespace net |
| OLD | NEW |