| 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/tools/quic/quic_simple_server.h" | 5 #include "net/tools/quic/quic_simple_server.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 void set_shared_writer(QuicSimpleServerPacketWriter* shared_writer) { | 56 void set_shared_writer(QuicSimpleServerPacketWriter* shared_writer) { |
| 57 shared_writer_ = shared_writer; | 57 shared_writer_ = shared_writer; |
| 58 } | 58 } |
| 59 | 59 |
| 60 private: | 60 private: |
| 61 QuicSimpleServerPacketWriter* shared_writer_; // Not owned. | 61 QuicSimpleServerPacketWriter* shared_writer_; // Not owned. |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // namespace | 64 } // namespace |
| 65 | 65 |
| 66 QuicSimpleServer::QuicSimpleServer(const QuicConfig& config, | 66 QuicSimpleServer::QuicSimpleServer(ProofSource* proof_source, |
| 67 const QuicConfig& config, |
| 67 const QuicVersionVector& supported_versions) | 68 const QuicVersionVector& supported_versions) |
| 68 : helper_(base::ThreadTaskRunnerHandle::Get().get(), | 69 : helper_(base::ThreadTaskRunnerHandle::Get().get(), |
| 69 &clock_, | 70 &clock_, |
| 70 QuicRandom::GetInstance()), | 71 QuicRandom::GetInstance()), |
| 71 config_(config), | 72 config_(config), |
| 72 crypto_config_(kSourceAddressTokenSecret, QuicRandom::GetInstance()), | 73 crypto_config_(kSourceAddressTokenSecret, |
| 74 QuicRandom::GetInstance(), |
| 75 proof_source), |
| 73 supported_versions_(supported_versions), | 76 supported_versions_(supported_versions), |
| 74 read_pending_(false), | 77 read_pending_(false), |
| 75 synchronous_read_count_(0), | 78 synchronous_read_count_(0), |
| 76 read_buffer_(new IOBufferWithSize(kReadBufferSize)), | 79 read_buffer_(new IOBufferWithSize(kReadBufferSize)), |
| 77 weak_factory_(this) { | 80 weak_factory_(this) { |
| 78 Initialize(); | 81 Initialize(); |
| 79 } | 82 } |
| 80 | 83 |
| 81 void QuicSimpleServer::Initialize() { | 84 void QuicSimpleServer::Initialize() { |
| 82 #if MMSG_MORE | 85 #if MMSG_MORE |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 } | 216 } |
| 214 | 217 |
| 215 QuicEncryptedPacket packet(read_buffer_->data(), result, false); | 218 QuicEncryptedPacket packet(read_buffer_->data(), result, false); |
| 216 dispatcher_->ProcessPacket(server_address_, client_address_, packet); | 219 dispatcher_->ProcessPacket(server_address_, client_address_, packet); |
| 217 | 220 |
| 218 StartReading(); | 221 StartReading(); |
| 219 } | 222 } |
| 220 | 223 |
| 221 } // namespace tools | 224 } // namespace tools |
| 222 } // namespace net | 225 } // namespace net |
| OLD | NEW |