| 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" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 int rc = socket->Listen(address); | 68 int rc = socket->Listen(address); |
| 69 if (rc < 0) { | 69 if (rc < 0) { |
| 70 LOG(ERROR) << "Listen() failed: " << ErrorToString(rc); | 70 LOG(ERROR) << "Listen() failed: " << ErrorToString(rc); |
| 71 return rc; | 71 return rc; |
| 72 } | 72 } |
| 73 | 73 |
| 74 // These send and receive buffer sizes are sized for a single connection, | 74 // These send and receive buffer sizes are sized for a single connection, |
| 75 // because the default usage of QuicServer is as a test server with one or | 75 // because the default usage of QuicServer is as a test server with one or |
| 76 // two clients. Adjust higher for use with many clients. | 76 // two clients. Adjust higher for use with many clients. |
| 77 rc = socket->SetReceiveBufferSize(TcpReceiver::kReceiveWindowTCP); | 77 rc = socket->SetReceiveBufferSize( |
| 78 static_cast<int32>(TcpReceiver::kReceiveWindowTCP)); |
| 78 if (rc < 0) { | 79 if (rc < 0) { |
| 79 LOG(ERROR) << "SetReceiveBufferSize() failed: " << ErrorToString(rc); | 80 LOG(ERROR) << "SetReceiveBufferSize() failed: " << ErrorToString(rc); |
| 80 return rc; | 81 return rc; |
| 81 } | 82 } |
| 82 | 83 |
| 83 rc = socket->SetSendBufferSize(20 * kMaxPacketSize); | 84 rc = socket->SetSendBufferSize(20 * kMaxPacketSize); |
| 84 if (rc < 0) { | 85 if (rc < 0) { |
| 85 LOG(ERROR) << "SetSendBufferSize() failed: " << ErrorToString(rc); | 86 LOG(ERROR) << "SetSendBufferSize() failed: " << ErrorToString(rc); |
| 86 return rc; | 87 return rc; |
| 87 } | 88 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 return; | 164 return; |
| 164 } | 165 } |
| 165 | 166 |
| 166 QuicEncryptedPacket packet(read_buffer_->data(), result, false); | 167 QuicEncryptedPacket packet(read_buffer_->data(), result, false); |
| 167 dispatcher_->ProcessPacket(server_address_, client_address_, packet); | 168 dispatcher_->ProcessPacket(server_address_, client_address_, packet); |
| 168 | 169 |
| 169 StartReading(); | 170 StartReading(); |
| 170 } | 171 } |
| 171 | 172 |
| 172 } // namespace net | 173 } // namespace net |
| OLD | NEW |