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_server.h" | 5 #include "net/quic/quic_server.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "net/base/ip_endpoint.h" | 9 #include "net/base/ip_endpoint.h" |
10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
11 #include "net/quic/congestion_control/tcp_receiver.h" | |
12 #include "net/quic/crypto/crypto_handshake.h" | 11 #include "net/quic/crypto/crypto_handshake.h" |
13 #include "net/quic/crypto/quic_random.h" | 12 #include "net/quic/crypto/quic_random.h" |
14 #include "net/quic/quic_crypto_stream.h" | 13 #include "net/quic/quic_crypto_stream.h" |
15 #include "net/quic/quic_data_reader.h" | 14 #include "net/quic/quic_data_reader.h" |
16 #include "net/quic/quic_dispatcher.h" | 15 #include "net/quic/quic_dispatcher.h" |
17 #include "net/quic/quic_in_memory_cache.h" | 16 #include "net/quic/quic_in_memory_cache.h" |
18 #include "net/quic/quic_protocol.h" | 17 #include "net/quic/quic_protocol.h" |
19 #include "net/quic/quic_server_packet_writer.h" | 18 #include "net/quic/quic_server_packet_writer.h" |
20 #include "net/udp/udp_server_socket.h" | 19 #include "net/udp/udp_server_socket.h" |
21 | 20 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 int rc = socket->Listen(address); | 86 int rc = socket->Listen(address); |
88 if (rc < 0) { | 87 if (rc < 0) { |
89 LOG(ERROR) << "Listen() failed: " << ErrorToString(rc); | 88 LOG(ERROR) << "Listen() failed: " << ErrorToString(rc); |
90 return rc; | 89 return rc; |
91 } | 90 } |
92 | 91 |
93 // These send and receive buffer sizes are sized for a single connection, | 92 // These send and receive buffer sizes are sized for a single connection, |
94 // because the default usage of QuicServer is as a test server with one or | 93 // because the default usage of QuicServer is as a test server with one or |
95 // two clients. Adjust higher for use with many clients. | 94 // two clients. Adjust higher for use with many clients. |
96 rc = socket->SetReceiveBufferSize( | 95 rc = socket->SetReceiveBufferSize( |
97 static_cast<int32>(TcpReceiver::kReceiveWindowTCP)); | 96 static_cast<int32>(kDefaultSocketReceiveBuffer)); |
98 if (rc < 0) { | 97 if (rc < 0) { |
99 LOG(ERROR) << "SetReceiveBufferSize() failed: " << ErrorToString(rc); | 98 LOG(ERROR) << "SetReceiveBufferSize() failed: " << ErrorToString(rc); |
100 return rc; | 99 return rc; |
101 } | 100 } |
102 | 101 |
103 rc = socket->SetSendBufferSize(20 * kMaxPacketSize); | 102 rc = socket->SetSendBufferSize(20 * kMaxPacketSize); |
104 if (rc < 0) { | 103 if (rc < 0) { |
105 LOG(ERROR) << "SetSendBufferSize() failed: " << ErrorToString(rc); | 104 LOG(ERROR) << "SetSendBufferSize() failed: " << ErrorToString(rc); |
106 return rc; | 105 return rc; |
107 } | 106 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 return; | 182 return; |
184 } | 183 } |
185 | 184 |
186 QuicEncryptedPacket packet(read_buffer_->data(), result, false); | 185 QuicEncryptedPacket packet(read_buffer_->data(), result, false); |
187 dispatcher_->ProcessPacket(server_address_, client_address_, packet); | 186 dispatcher_->ProcessPacket(server_address_, client_address_, packet); |
188 | 187 |
189 StartReading(); | 188 StartReading(); |
190 } | 189 } |
191 | 190 |
192 } // namespace net | 191 } // namespace net |
OLD | NEW |