| 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 19 matching lines...) Expand all Loading... |
| 30 // Allocate some extra space so we can send an error if the client goes over | 30 // Allocate some extra space so we can send an error if the client goes over |
| 31 // the limit. | 31 // the limit. |
| 32 const int kReadBufferSize = 2 * kMaxPacketSize; | 32 const int kReadBufferSize = 2 * kMaxPacketSize; |
| 33 | 33 |
| 34 class SimpleQuicDispatcher : public QuicDispatcher { | 34 class SimpleQuicDispatcher : public QuicDispatcher { |
| 35 public: | 35 public: |
| 36 SimpleQuicDispatcher(const QuicConfig& config, | 36 SimpleQuicDispatcher(const QuicConfig& config, |
| 37 const QuicCryptoServerConfig* crypto_config, | 37 const QuicCryptoServerConfig* crypto_config, |
| 38 const QuicVersionVector& supported_versions, | 38 const QuicVersionVector& supported_versions, |
| 39 QuicConnectionHelperInterface* helper) | 39 QuicConnectionHelperInterface* helper) |
| 40 : QuicDispatcher(config, crypto_config, supported_versions, helper) {} | 40 : QuicDispatcher(config, crypto_config, supported_versions, |
| 41 std::unique_ptr<QuicConnectionHelperInterface>(helper)) {
} |
| 41 | 42 |
| 42 protected: | 43 protected: |
| 43 QuicServerSessionBase* CreateQuicSession( | 44 QuicServerSessionBase* CreateQuicSession( |
| 44 QuicConnectionId connection_id, | 45 QuicConnectionId connection_id, |
| 45 const IPEndPoint& client_address) override { | 46 const IPEndPoint& client_address) override { |
| 46 QuicServerSessionBase* session = | 47 QuicServerSessionBase* session = |
| 47 QuicDispatcher::CreateQuicSession(connection_id, client_address); | 48 QuicDispatcher::CreateQuicSession(connection_id, client_address); |
| 48 static_cast<QuicSimplePerConnectionPacketWriter*>( | 49 static_cast<QuicSimplePerConnectionPacketWriter*>( |
| 49 session->connection()->writer()) | 50 session->connection()->writer()) |
| 50 ->set_connection(session->connection()); | 51 ->set_connection(session->connection()); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 } | 204 } |
| 204 | 205 |
| 205 QuicReceivedPacket packet(read_buffer_->data(), result, | 206 QuicReceivedPacket packet(read_buffer_->data(), result, |
| 206 helper_->GetClock()->Now(), false); | 207 helper_->GetClock()->Now(), false); |
| 207 dispatcher_->ProcessPacket(server_address_, client_address_, packet); | 208 dispatcher_->ProcessPacket(server_address_, client_address_, packet); |
| 208 | 209 |
| 209 StartReading(); | 210 StartReading(); |
| 210 } | 211 } |
| 211 | 212 |
| 212 } // namespace net | 213 } // namespace net |
| OLD | NEW |