| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_server.h" | 5 #include "net/tools/quic/quic_server.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <features.h> | 8 #include <features.h> |
| 9 #include <netinet/in.h> | 9 #include <netinet/in.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 config_(config), | 60 config_(config), |
| 61 crypto_config_(kSourceAddressTokenSecret, QuicRandom::GetInstance()), | 61 crypto_config_(kSourceAddressTokenSecret, QuicRandom::GetInstance()), |
| 62 supported_versions_(supported_versions) { | 62 supported_versions_(supported_versions) { |
| 63 Initialize(); | 63 Initialize(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void QuicServer::Initialize() { | 66 void QuicServer::Initialize() { |
| 67 #if MMSG_MORE | 67 #if MMSG_MORE |
| 68 use_recvmmsg_ = true; | 68 use_recvmmsg_ = true; |
| 69 #endif | 69 #endif |
| 70 |
| 71 // If an initial flow control window has not explicitly been set, then use a |
| 72 // sensible value for a server: 1 MB for session, 64 KB for each stream. |
| 73 const uint32 kInitialSessionFlowControlWindow = 1 * 1024 * 1024; // 1 MB |
| 74 const uint32 kInitialStreamFlowControlWindow = 64 * 1024; // 64 KB |
| 75 if (config_.GetInitialFlowControlWindowToSend() == |
| 76 kMinimumFlowControlSendWindow) { |
| 77 config_.SetInitialFlowControlWindowToSend(kInitialSessionFlowControlWindow); |
| 78 } |
| 79 if (config_.GetInitialStreamFlowControlWindowToSend() == |
| 80 kMinimumFlowControlSendWindow) { |
| 81 config_.SetInitialStreamFlowControlWindowToSend( |
| 82 kInitialStreamFlowControlWindow); |
| 83 } |
| 84 if (config_.GetInitialSessionFlowControlWindowToSend() == |
| 85 kMinimumFlowControlSendWindow) { |
| 86 config_.SetInitialSessionFlowControlWindowToSend( |
| 87 kInitialSessionFlowControlWindow); |
| 88 } |
| 89 |
| 70 epoll_server_.set_timeout_in_us(50 * 1000); | 90 epoll_server_.set_timeout_in_us(50 * 1000); |
| 71 // Initialize the in memory cache now. | 91 // Initialize the in memory cache now. |
| 72 QuicInMemoryCache::GetInstance(); | 92 QuicInMemoryCache::GetInstance(); |
| 73 | 93 |
| 74 QuicEpollClock clock(&epoll_server_); | 94 QuicEpollClock clock(&epoll_server_); |
| 75 | 95 |
| 76 scoped_ptr<CryptoHandshakeMessage> scfg( | 96 scoped_ptr<CryptoHandshakeMessage> scfg( |
| 77 crypto_config_.AddDefaultConfig( | 97 crypto_config_.AddDefaultConfig( |
| 78 QuicRandom::GetInstance(), &clock, | 98 QuicRandom::GetInstance(), &clock, |
| 79 QuicCryptoServerConfig::ConfigOptions())); | 99 QuicCryptoServerConfig::ConfigOptions())); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 QuicEncryptedPacket packet(buf, bytes_read, false); | 243 QuicEncryptedPacket packet(buf, bytes_read, false); |
| 224 | 244 |
| 225 IPEndPoint server_address(server_ip, port); | 245 IPEndPoint server_address(server_ip, port); |
| 226 processor->ProcessPacket(server_address, client_address, packet); | 246 processor->ProcessPacket(server_address, client_address, packet); |
| 227 | 247 |
| 228 return true; | 248 return true; |
| 229 } | 249 } |
| 230 | 250 |
| 231 } // namespace tools | 251 } // namespace tools |
| 232 } // namespace net | 252 } // namespace net |
| OLD | NEW |