| 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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 write_blocked_list_.insert(make_pair(blocked_writer, true)); | 345 write_blocked_list_.insert(make_pair(blocked_writer, true)); |
| 346 } | 346 } |
| 347 | 347 |
| 348 QuicSession* QuicDispatcher::CreateQuicSession( | 348 QuicSession* QuicDispatcher::CreateQuicSession( |
| 349 QuicConnectionId connection_id, | 349 QuicConnectionId connection_id, |
| 350 const IPEndPoint& server_address, | 350 const IPEndPoint& server_address, |
| 351 const IPEndPoint& client_address) { | 351 const IPEndPoint& client_address) { |
| 352 QuicServerSession* session = new QuicServerSession( | 352 QuicServerSession* session = new QuicServerSession( |
| 353 config_, | 353 config_, |
| 354 CreateQuicConnection(connection_id, server_address, client_address), | 354 CreateQuicConnection(connection_id, server_address, client_address), |
| 355 this, | 355 this); |
| 356 crypto_config_.HasProofSource()); | |
| 357 session->InitializeSession(crypto_config_); | 356 session->InitializeSession(crypto_config_); |
| 358 return session; | 357 return session; |
| 359 } | 358 } |
| 360 | 359 |
| 361 QuicConnection* QuicDispatcher::CreateQuicConnection( | 360 QuicConnection* QuicDispatcher::CreateQuicConnection( |
| 362 QuicConnectionId connection_id, | 361 QuicConnectionId connection_id, |
| 363 const IPEndPoint& server_address, | 362 const IPEndPoint& server_address, |
| 364 const IPEndPoint& client_address) { | 363 const IPEndPoint& client_address) { |
| 365 return new QuicConnection(connection_id, | 364 return new QuicConnection(connection_id, |
| 366 client_address, | 365 client_address, |
| 367 helper_, | 366 helper_, |
| 368 connection_writer_factory_, | 367 connection_writer_factory_, |
| 369 /* owns_writer= */ true, | 368 /* owns_writer= */ true, |
| 370 /* is_server= */ true, | 369 /* is_server= */ true, |
| 370 crypto_config_.HasProofSource(), |
| 371 supported_versions_); | 371 supported_versions_); |
| 372 } | 372 } |
| 373 | 373 |
| 374 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { | 374 QuicTimeWaitListManager* QuicDispatcher::CreateQuicTimeWaitListManager() { |
| 375 return new QuicTimeWaitListManager( | 375 return new QuicTimeWaitListManager( |
| 376 writer_.get(), this, helper_, supported_versions()); | 376 writer_.get(), this, helper_, supported_versions()); |
| 377 } | 377 } |
| 378 | 378 |
| 379 bool QuicDispatcher::HandlePacketForTimeWait( | 379 bool QuicDispatcher::HandlePacketForTimeWait( |
| 380 const QuicPacketPublicHeader& header) { | 380 const QuicPacketPublicHeader& header) { |
| 381 if (header.reset_flag) { | 381 if (header.reset_flag) { |
| 382 // Public reset packets do not have sequence numbers, so ignore the packet. | 382 // Public reset packets do not have sequence numbers, so ignore the packet. |
| 383 return false; | 383 return false; |
| 384 } | 384 } |
| 385 | 385 |
| 386 // Switch the framer to the correct version, so that the sequence number can | 386 // Switch the framer to the correct version, so that the sequence number can |
| 387 // be parsed correctly. | 387 // be parsed correctly. |
| 388 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( | 388 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( |
| 389 header.connection_id)); | 389 header.connection_id)); |
| 390 | 390 |
| 391 // Continue parsing the packet to extract the sequence number. Then | 391 // Continue parsing the packet to extract the sequence number. Then |
| 392 // send it to the time wait manager in OnUnathenticatedHeader. | 392 // send it to the time wait manager in OnUnathenticatedHeader. |
| 393 return true; | 393 return true; |
| 394 } | 394 } |
| 395 | 395 |
| 396 } // namespace net | 396 } // namespace net |
| OLD | NEW |