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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 framer_(supported_versions, /*unused*/ QuicTime::Zero(), true), | 170 framer_(supported_versions, /*unused*/ QuicTime::Zero(), true), |
171 framer_visitor_(new QuicFramerVisitor(this)) { | 171 framer_visitor_(new QuicFramerVisitor(this)) { |
172 framer_.set_visitor(framer_visitor_.get()); | 172 framer_.set_visitor(framer_visitor_.get()); |
173 } | 173 } |
174 | 174 |
175 QuicDispatcher::~QuicDispatcher() { | 175 QuicDispatcher::~QuicDispatcher() { |
176 STLDeleteValues(&session_map_); | 176 STLDeleteValues(&session_map_); |
177 STLDeleteElements(&closed_session_list_); | 177 STLDeleteElements(&closed_session_list_); |
178 } | 178 } |
179 | 179 |
180 void QuicDispatcher::Initialize(QuicPacketWriter* writer) { | 180 void QuicDispatcher::Initialize(QuicServerPacketWriter* writer) { |
181 DCHECK(writer_ == NULL); | 181 DCHECK(writer_ == NULL); |
182 writer_.reset(writer); | 182 writer_.reset(writer); |
183 time_wait_list_manager_.reset(CreateQuicTimeWaitListManager()); | 183 time_wait_list_manager_.reset(CreateQuicTimeWaitListManager()); |
184 | 184 |
185 // Remove all versions > QUIC_VERSION_16 from the | 185 // Remove all versions > QUIC_VERSION_16 from the |
186 // supported_versions_no_flow_control_ vector. | 186 // supported_versions_no_flow_control_ vector. |
187 QuicVersionVector::iterator it = | 187 QuicVersionVector::iterator it = |
188 find(supported_versions_no_flow_control_.begin(), | 188 find(supported_versions_no_flow_control_.begin(), |
189 supported_versions_no_flow_control_.end(), QUIC_VERSION_17); | 189 supported_versions_no_flow_control_.end(), QUIC_VERSION_17); |
190 if (it != supported_versions_no_flow_control_.end()) { | 190 if (it != supported_versions_no_flow_control_.end()) { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 | 359 |
360 void QuicDispatcher::OnWriteBlocked(QuicBlockedWriterInterface* writer) { | 360 void QuicDispatcher::OnWriteBlocked(QuicBlockedWriterInterface* writer) { |
361 DCHECK(writer_->IsWriteBlocked()); | 361 DCHECK(writer_->IsWriteBlocked()); |
362 write_blocked_list_.insert(make_pair(writer, true)); | 362 write_blocked_list_.insert(make_pair(writer, true)); |
363 } | 363 } |
364 | 364 |
365 QuicSession* QuicDispatcher::CreateQuicSession( | 365 QuicSession* QuicDispatcher::CreateQuicSession( |
366 QuicConnectionId connection_id, | 366 QuicConnectionId connection_id, |
367 const IPEndPoint& server_address, | 367 const IPEndPoint& server_address, |
368 const IPEndPoint& client_address) { | 368 const IPEndPoint& client_address) { |
| 369 QuicConnection* connection = |
| 370 CreateQuicConnection(connection_id, server_address, client_address); |
| 371 QuicConnectionPacketWriterWrapper* connection_packet_writer = |
| 372 new QuicConnectionPacketWriterWrapper(writer_.get(), connection); |
369 QuicServerSession* session = new QuicServerSession( | 373 QuicServerSession* session = new QuicServerSession( |
370 config_, | 374 config_, |
371 CreateQuicConnection(connection_id, server_address, client_address), | 375 connection, |
| 376 connection_packet_writer, |
372 this); | 377 this); |
373 session->InitializeSession(crypto_config_); | 378 session->InitializeSession(crypto_config_); |
374 return session; | 379 return session; |
375 } | 380 } |
376 | 381 |
377 QuicConnection* QuicDispatcher::CreateQuicConnection( | 382 QuicConnection* QuicDispatcher::CreateQuicConnection( |
378 QuicConnectionId connection_id, | 383 QuicConnectionId connection_id, |
379 const IPEndPoint& server_address, | 384 const IPEndPoint& server_address, |
380 const IPEndPoint& client_address) { | 385 const IPEndPoint& client_address) { |
381 if (FLAGS_enable_quic_stream_flow_control_2 && | 386 if (FLAGS_enable_quic_stream_flow_control_2 && |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 // be parsed correctly. | 422 // be parsed correctly. |
418 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( | 423 framer_.set_version(time_wait_list_manager_->GetQuicVersionFromConnectionId( |
419 header.connection_id)); | 424 header.connection_id)); |
420 | 425 |
421 // Continue parsing the packet to extract the sequence number. Then | 426 // Continue parsing the packet to extract the sequence number. Then |
422 // send it to the time wait manager in OnUnathenticatedHeader. | 427 // send it to the time wait manager in OnUnathenticatedHeader. |
423 return true; | 428 return true; |
424 } | 429 } |
425 | 430 |
426 } // namespace net | 431 } // namespace net |
OLD | NEW |