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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 private: | 155 private: |
156 QuicDispatcher* dispatcher_; | 156 QuicDispatcher* dispatcher_; |
157 | 157 |
158 // Latched in OnUnauthenticatedPublicHeader for use later. | 158 // Latched in OnUnauthenticatedPublicHeader for use later. |
159 QuicConnectionId connection_id_; | 159 QuicConnectionId connection_id_; |
160 }; | 160 }; |
161 | 161 |
162 QuicDispatcher::QuicDispatcher(const QuicConfig& config, | 162 QuicDispatcher::QuicDispatcher(const QuicConfig& config, |
163 const QuicCryptoServerConfig& crypto_config, | 163 const QuicCryptoServerConfig& crypto_config, |
164 const QuicVersionVector& supported_versions, | 164 const QuicVersionVector& supported_versions, |
165 EpollServer* epoll_server, | 165 EpollServer* epoll_server) |
166 uint32 initial_flow_control_window_bytes) | |
167 : config_(config), | 166 : config_(config), |
168 crypto_config_(crypto_config), | 167 crypto_config_(crypto_config), |
169 delete_sessions_alarm_(new DeleteSessionsAlarm(this)), | 168 delete_sessions_alarm_(new DeleteSessionsAlarm(this)), |
170 epoll_server_(epoll_server), | 169 epoll_server_(epoll_server), |
171 helper_(new QuicEpollConnectionHelper(epoll_server_)), | 170 helper_(new QuicEpollConnectionHelper(epoll_server_)), |
172 supported_versions_(supported_versions), | 171 supported_versions_(supported_versions), |
173 supported_versions_no_flow_control_(supported_versions), | 172 supported_versions_no_flow_control_(supported_versions), |
174 supported_versions_no_connection_flow_control_(supported_versions), | 173 supported_versions_no_connection_flow_control_(supported_versions), |
175 current_packet_(NULL), | 174 current_packet_(NULL), |
176 framer_(supported_versions, /*unused*/ QuicTime::Zero(), true), | 175 framer_(supported_versions, /*unused*/ QuicTime::Zero(), true), |
177 framer_visitor_(new QuicFramerVisitor(this)), | 176 framer_visitor_(new QuicFramerVisitor(this)) { |
178 initial_flow_control_window_bytes_(initial_flow_control_window_bytes) { | |
179 framer_.set_visitor(framer_visitor_.get()); | 177 framer_.set_visitor(framer_visitor_.get()); |
180 } | 178 } |
181 | 179 |
182 QuicDispatcher::~QuicDispatcher() { | 180 QuicDispatcher::~QuicDispatcher() { |
183 STLDeleteValues(&session_map_); | 181 STLDeleteValues(&session_map_); |
184 STLDeleteElements(&closed_session_list_); | 182 STLDeleteElements(&closed_session_list_); |
185 } | 183 } |
186 | 184 |
187 void QuicDispatcher::Initialize(int fd) { | 185 void QuicDispatcher::Initialize(int fd) { |
188 DCHECK(writer_ == NULL); | 186 DCHECK(writer_ == NULL); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 return new QuicDefaultPacketWriter(fd); | 373 return new QuicDefaultPacketWriter(fd); |
376 } | 374 } |
377 | 375 |
378 QuicSession* QuicDispatcher::CreateQuicSession( | 376 QuicSession* QuicDispatcher::CreateQuicSession( |
379 QuicConnectionId connection_id, | 377 QuicConnectionId connection_id, |
380 const IPEndPoint& server_address, | 378 const IPEndPoint& server_address, |
381 const IPEndPoint& client_address) { | 379 const IPEndPoint& client_address) { |
382 QuicServerSession* session = new QuicServerSession( | 380 QuicServerSession* session = new QuicServerSession( |
383 config_, | 381 config_, |
384 CreateQuicConnection(connection_id, server_address, client_address), | 382 CreateQuicConnection(connection_id, server_address, client_address), |
385 initial_flow_control_window_bytes_, | |
386 this); | 383 this); |
387 session->InitializeSession(crypto_config_); | 384 session->InitializeSession(crypto_config_); |
388 return session; | 385 return session; |
389 } | 386 } |
390 | 387 |
391 QuicConnection* QuicDispatcher::CreateQuicConnection( | 388 QuicConnection* QuicDispatcher::CreateQuicConnection( |
392 QuicConnectionId connection_id, | 389 QuicConnectionId connection_id, |
393 const IPEndPoint& server_address, | 390 const IPEndPoint& server_address, |
394 const IPEndPoint& client_address) { | 391 const IPEndPoint& client_address) { |
395 if (FLAGS_enable_quic_stream_flow_control_2 && | 392 if (FLAGS_enable_quic_stream_flow_control_2 && |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( | 429 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( |
433 header.connection_id)); | 430 header.connection_id)); |
434 | 431 |
435 // Continue parsing the packet to extract the sequence number. Then | 432 // Continue parsing the packet to extract the sequence number. Then |
436 // send it to the time wait manager in OnUnathenticatedHeader. | 433 // send it to the time wait manager in OnUnathenticatedHeader. |
437 return true; | 434 return true; |
438 } | 435 } |
439 | 436 |
440 } // namespace tools | 437 } // namespace tools |
441 } // namespace net | 438 } // namespace net |
OLD | NEW |