Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(120)

Side by Side Diff: net/tools/quic/quic_simple_server.cc

Issue 2333923004: Extracting NetLog inner classes into their own classes. (Closed)
Patch Set: Some nit fixes and better, impl-agnostic naming of net_log_parameters_callback_typedef.h -> net/log… Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
12 #include "net/base/ip_endpoint.h" 12 #include "net/base/ip_endpoint.h"
13 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
14 #include "net/log/net_log_source.h"
14 #include "net/quic/core/crypto/crypto_handshake.h" 15 #include "net/quic/core/crypto/crypto_handshake.h"
15 #include "net/quic/core/crypto/quic_random.h" 16 #include "net/quic/core/crypto/quic_random.h"
16 #include "net/quic/core/quic_crypto_stream.h" 17 #include "net/quic/core/quic_crypto_stream.h"
17 #include "net/quic/core/quic_data_reader.h" 18 #include "net/quic/core/quic_data_reader.h"
18 #include "net/quic/core/quic_protocol.h" 19 #include "net/quic/core/quic_protocol.h"
19 #include "net/tools/quic/quic_simple_dispatcher.h" 20 #include "net/tools/quic/quic_simple_dispatcher.h"
20 #include "net/tools/quic/quic_simple_per_connection_packet_writer.h" 21 #include "net/tools/quic/quic_simple_per_connection_packet_writer.h"
21 #include "net/tools/quic/quic_simple_server_packet_writer.h" 22 #include "net/tools/quic/quic_simple_server_packet_writer.h"
22 #include "net/tools/quic/quic_simple_server_session_helper.h" 23 #include "net/tools/quic/quic_simple_server_session_helper.h"
23 #include "net/udp/udp_server_socket.h" 24 #include "net/udp/udp_server_socket.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 81
81 std::unique_ptr<CryptoHandshakeMessage> scfg(crypto_config_.AddDefaultConfig( 82 std::unique_ptr<CryptoHandshakeMessage> scfg(crypto_config_.AddDefaultConfig(
82 helper_->GetRandomGenerator(), helper_->GetClock(), 83 helper_->GetRandomGenerator(), helper_->GetClock(),
83 crypto_config_options_)); 84 crypto_config_options_));
84 } 85 }
85 86
86 QuicSimpleServer::~QuicSimpleServer() {} 87 QuicSimpleServer::~QuicSimpleServer() {}
87 88
88 int QuicSimpleServer::Listen(const IPEndPoint& address) { 89 int QuicSimpleServer::Listen(const IPEndPoint& address) {
89 std::unique_ptr<UDPServerSocket> socket( 90 std::unique_ptr<UDPServerSocket> socket(
90 new UDPServerSocket(&net_log_, NetLog::Source())); 91 new UDPServerSocket(&net_log_, NetLogSource()));
91 92
92 socket->AllowAddressReuse(); 93 socket->AllowAddressReuse();
93 94
94 int rc = socket->Listen(address); 95 int rc = socket->Listen(address);
95 if (rc < 0) { 96 if (rc < 0) {
96 LOG(ERROR) << "Listen() failed: " << ErrorToString(rc); 97 LOG(ERROR) << "Listen() failed: " << ErrorToString(rc);
97 return rc; 98 return rc;
98 } 99 }
99 100
100 // These send and receive buffer sizes are sized for a single connection, 101 // These send and receive buffer sizes are sized for a single connection,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 198 }
198 199
199 QuicReceivedPacket packet(read_buffer_->data(), result, 200 QuicReceivedPacket packet(read_buffer_->data(), result,
200 helper_->GetClock()->Now(), false); 201 helper_->GetClock()->Now(), false);
201 dispatcher_->ProcessPacket(server_address_, client_address_, packet); 202 dispatcher_->ProcessPacket(server_address_, client_address_, packet);
202 203
203 StartReading(); 204 StartReading();
204 } 205 }
205 206
206 } // namespace net 207 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698