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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | 382 CreateQuicConnection(connection_id, |
385 server_address, | 383 server_address, |
386 client_address), | 384 client_address), |
387 initial_flow_control_window_bytes_, | |
388 this); | 385 this); |
389 session->InitializeSession(crypto_config_); | 386 session->InitializeSession(crypto_config_); |
390 return session; | 387 return session; |
391 } | 388 } |
392 | 389 |
393 QuicConnection* QuicDispatcher::CreateQuicConnection( | 390 QuicConnection* QuicDispatcher::CreateQuicConnection( |
394 QuicConnectionId connection_id, | 391 QuicConnectionId connection_id, |
395 const IPEndPoint& server_address, | 392 const IPEndPoint& server_address, |
396 const IPEndPoint& client_address) { | 393 const IPEndPoint& client_address) { |
397 if (FLAGS_enable_quic_stream_flow_control_2 && | 394 if (FLAGS_enable_quic_stream_flow_control_2 && |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( | 431 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( |
435 header.connection_id)); | 432 header.connection_id)); |
436 | 433 |
437 // Continue parsing the packet to extract the sequence number. Then | 434 // Continue parsing the packet to extract the sequence number. Then |
438 // send it to the time wait manager in OnUnathenticatedHeader. | 435 // send it to the time wait manager in OnUnathenticatedHeader. |
439 return true; | 436 return true; |
440 } | 437 } |
441 | 438 |
442 } // namespace tools | 439 } // namespace tools |
443 } // namespace net | 440 } // namespace net |
OLD | NEW |