| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 private: | 150 private: |
| 151 QuicDispatcher* dispatcher_; | 151 QuicDispatcher* dispatcher_; |
| 152 | 152 |
| 153 // Latched in OnUnauthenticatedPublicHeader for use later. | 153 // Latched in OnUnauthenticatedPublicHeader for use later. |
| 154 QuicConnectionId connection_id_; | 154 QuicConnectionId connection_id_; |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 QuicDispatcher::QuicDispatcher(const QuicConfig& config, | 157 QuicDispatcher::QuicDispatcher(const QuicConfig& config, |
| 158 const QuicCryptoServerConfig& crypto_config, | 158 const QuicCryptoServerConfig& crypto_config, |
| 159 const QuicVersionVector& supported_versions, | 159 const QuicVersionVector& supported_versions, |
| 160 QuicConnectionHelperInterface* helper, | 160 QuicConnectionHelperInterface* helper) |
| 161 uint32 initial_flow_control_window_bytes) | |
| 162 : config_(config), | 161 : config_(config), |
| 163 crypto_config_(crypto_config), | 162 crypto_config_(crypto_config), |
| 164 helper_(helper), | 163 helper_(helper), |
| 165 delete_sessions_alarm_( | 164 delete_sessions_alarm_( |
| 166 helper_->CreateAlarm(new DeleteSessionsAlarm(this))), | 165 helper_->CreateAlarm(new DeleteSessionsAlarm(this))), |
| 167 supported_versions_(supported_versions), | 166 supported_versions_(supported_versions), |
| 168 supported_versions_no_flow_control_(supported_versions), | 167 supported_versions_no_flow_control_(supported_versions), |
| 169 supported_versions_no_connection_flow_control_(supported_versions), | 168 supported_versions_no_connection_flow_control_(supported_versions), |
| 170 current_packet_(NULL), | 169 current_packet_(NULL), |
| 171 framer_(supported_versions, /*unused*/ QuicTime::Zero(), true), | 170 framer_(supported_versions, /*unused*/ QuicTime::Zero(), true), |
| 172 framer_visitor_(new QuicFramerVisitor(this)), | 171 framer_visitor_(new QuicFramerVisitor(this)) { |
| 173 initial_flow_control_window_bytes_(initial_flow_control_window_bytes) { | |
| 174 framer_.set_visitor(framer_visitor_.get()); | 172 framer_.set_visitor(framer_visitor_.get()); |
| 175 } | 173 } |
| 176 | 174 |
| 177 QuicDispatcher::~QuicDispatcher() { | 175 QuicDispatcher::~QuicDispatcher() { |
| 178 STLDeleteValues(&session_map_); | 176 STLDeleteValues(&session_map_); |
| 179 STLDeleteElements(&closed_session_list_); | 177 STLDeleteElements(&closed_session_list_); |
| 180 } | 178 } |
| 181 | 179 |
| 182 void QuicDispatcher::Initialize(QuicPacketWriter* writer) { | 180 void QuicDispatcher::Initialize(QuicPacketWriter* writer) { |
| 183 DCHECK(writer_ == NULL); | 181 DCHECK(writer_ == NULL); |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 write_blocked_list_.insert(make_pair(writer, true)); | 362 write_blocked_list_.insert(make_pair(writer, true)); |
| 365 } | 363 } |
| 366 | 364 |
| 367 QuicSession* QuicDispatcher::CreateQuicSession( | 365 QuicSession* QuicDispatcher::CreateQuicSession( |
| 368 QuicConnectionId connection_id, | 366 QuicConnectionId connection_id, |
| 369 const IPEndPoint& server_address, | 367 const IPEndPoint& server_address, |
| 370 const IPEndPoint& client_address) { | 368 const IPEndPoint& client_address) { |
| 371 QuicServerSession* session = new QuicServerSession( | 369 QuicServerSession* session = new QuicServerSession( |
| 372 config_, | 370 config_, |
| 373 CreateQuicConnection(connection_id, server_address, client_address), | 371 CreateQuicConnection(connection_id, server_address, client_address), |
| 374 initial_flow_control_window_bytes_, | |
| 375 this); | 372 this); |
| 376 session->InitializeSession(crypto_config_); | 373 session->InitializeSession(crypto_config_); |
| 377 return session; | 374 return session; |
| 378 } | 375 } |
| 379 | 376 |
| 380 QuicConnection* QuicDispatcher::CreateQuicConnection( | 377 QuicConnection* QuicDispatcher::CreateQuicConnection( |
| 381 QuicConnectionId connection_id, | 378 QuicConnectionId connection_id, |
| 382 const IPEndPoint& server_address, | 379 const IPEndPoint& server_address, |
| 383 const IPEndPoint& client_address) { | 380 const IPEndPoint& client_address) { |
| 384 if (FLAGS_enable_quic_stream_flow_control_2 && | 381 if (FLAGS_enable_quic_stream_flow_control_2 && |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 // be parsed correctly. | 417 // be parsed correctly. |
| 421 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( | 418 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( |
| 422 header.connection_id)); | 419 header.connection_id)); |
| 423 | 420 |
| 424 // Continue parsing the packet to extract the sequence number. Then | 421 // Continue parsing the packet to extract the sequence number. Then |
| 425 // send it to the time wait manager in OnUnathenticatedHeader. | 422 // send it to the time wait manager in OnUnathenticatedHeader. |
| 426 return true; | 423 return true; |
| 427 } | 424 } |
| 428 | 425 |
| 429 } // namespace net | 426 } // namespace net |
| OLD | NEW |