| 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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 } | 375 } |
| 376 | 376 |
| 377 QuicSession* QuicDispatcher::CreateQuicSession( | 377 QuicSession* QuicDispatcher::CreateQuicSession( |
| 378 QuicConnectionId connection_id, | 378 QuicConnectionId connection_id, |
| 379 const IPEndPoint& server_address, | 379 const IPEndPoint& server_address, |
| 380 const IPEndPoint& client_address) { | 380 const IPEndPoint& client_address) { |
| 381 QuicServerSession* session = new QuicServerSession( | 381 QuicServerSession* session = new QuicServerSession( |
| 382 config_, | 382 config_, |
| 383 CreateQuicConnection(connection_id, | 383 CreateQuicConnection(connection_id, |
| 384 server_address, | 384 server_address, |
| 385 client_address, | 385 client_address), |
| 386 initial_flow_control_window_bytes_), | 386 initial_flow_control_window_bytes_, |
| 387 this); | 387 this); |
| 388 session->InitializeSession(crypto_config_); | 388 session->InitializeSession(crypto_config_); |
| 389 return session; | 389 return session; |
| 390 } | 390 } |
| 391 | 391 |
| 392 QuicConnection* QuicDispatcher::CreateQuicConnection( | 392 QuicConnection* QuicDispatcher::CreateQuicConnection( |
| 393 QuicConnectionId connection_id, | 393 QuicConnectionId connection_id, |
| 394 const IPEndPoint& server_address, | 394 const IPEndPoint& server_address, |
| 395 const IPEndPoint& client_address, | 395 const IPEndPoint& client_address) { |
| 396 uint32 initial_flow_control_window) { | |
| 397 if (FLAGS_enable_quic_stream_flow_control_2 && | 396 if (FLAGS_enable_quic_stream_flow_control_2 && |
| 398 FLAGS_enable_quic_connection_flow_control) { | 397 FLAGS_enable_quic_connection_flow_control) { |
| 399 DLOG(INFO) << "Creating QuicDispatcher with all versions."; | 398 DLOG(INFO) << "Creating QuicDispatcher with all versions."; |
| 400 return new QuicConnection(connection_id, client_address, helper_.get(), | 399 return new QuicConnection(connection_id, client_address, helper_.get(), |
| 401 writer_.get(), true, supported_versions_, | 400 writer_.get(), true, supported_versions_); |
| 402 initial_flow_control_window_bytes_); | |
| 403 } | 401 } |
| 404 | 402 |
| 405 if (FLAGS_enable_quic_stream_flow_control_2 && | 403 if (FLAGS_enable_quic_stream_flow_control_2 && |
| 406 !FLAGS_enable_quic_connection_flow_control) { | 404 !FLAGS_enable_quic_connection_flow_control) { |
| 407 DLOG(INFO) << "Connection flow control disabled, creating QuicDispatcher " | 405 DLOG(INFO) << "Connection flow control disabled, creating QuicDispatcher " |
| 408 << "WITHOUT version 19 or higher."; | 406 << "WITHOUT version 19 or higher."; |
| 409 return new QuicConnection(connection_id, client_address, helper_.get(), | 407 return new QuicConnection(connection_id, client_address, helper_.get(), |
| 410 writer_.get(), true, | 408 writer_.get(), true, |
| 411 supported_versions_no_connection_flow_control_, | 409 supported_versions_no_connection_flow_control_); |
| 412 initial_flow_control_window_bytes_); | |
| 413 } | 410 } |
| 414 | 411 |
| 415 DLOG(INFO) << "Flow control disabled, creating QuicDispatcher WITHOUT " | 412 DLOG(INFO) << "Flow control disabled, creating QuicDispatcher WITHOUT " |
| 416 << "version 17 or higher."; | 413 << "version 17 or higher."; |
| 417 return new QuicConnection( | 414 return new QuicConnection(connection_id, client_address, helper_.get(), |
| 418 connection_id, client_address, helper_.get(), writer_.get(), true, | 415 writer_.get(), true, |
| 419 supported_versions_no_flow_control_, initial_flow_control_window_bytes_); | 416 supported_versions_no_flow_control_); |
| 420 } | 417 } |
| 421 | 418 |
| 422 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { | 419 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { |
| 423 return new QuicTimeWaitListManager( | 420 return new QuicTimeWaitListManager( |
| 424 writer_.get(), this, epoll_server(), supported_versions()); | 421 writer_.get(), this, epoll_server(), supported_versions()); |
| 425 } | 422 } |
| 426 | 423 |
| 427 bool QuicDispatcher::HandlePacketForTimeWait( | 424 bool QuicDispatcher::HandlePacketForTimeWait( |
| 428 const QuicPacketPublicHeader& header) { | 425 const QuicPacketPublicHeader& header) { |
| 429 if (header.reset_flag) { | 426 if (header.reset_flag) { |
| 430 // Public reset packets do not have sequence numbers, so ignore the packet. | 427 // Public reset packets do not have sequence numbers, so ignore the packet. |
| 431 return false; | 428 return false; |
| 432 } | 429 } |
| 433 | 430 |
| 434 // Switch the framer to the correct version, so that the sequence number can | 431 // Switch the framer to the correct version, so that the sequence number can |
| 435 // be parsed correctly. | 432 // be parsed correctly. |
| 436 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( | 433 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( |
| 437 header.connection_id)); | 434 header.connection_id)); |
| 438 | 435 |
| 439 // Continue parsing the packet to extract the sequence number. Then | 436 // Continue parsing the packet to extract the sequence number. Then |
| 440 // send it to the time wait manager in OnUnathenticatedHeader. | 437 // send it to the time wait manager in OnUnathenticatedHeader. |
| 441 return true; | 438 return true; |
| 442 } | 439 } |
| 443 | 440 |
| 444 } // namespace tools | 441 } // namespace tools |
| 445 } // namespace net | 442 } // namespace net |
| OLD | NEW |