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 29 matching lines...) Expand all Loading... |
40 crypto_config_(kSourceAddressTokenSecret, QuicRandom::GetInstance()), | 40 crypto_config_(kSourceAddressTokenSecret, QuicRandom::GetInstance()), |
41 supported_versions_(supported_versions), | 41 supported_versions_(supported_versions), |
42 read_pending_(false), | 42 read_pending_(false), |
43 synchronous_read_count_(0), | 43 synchronous_read_count_(0), |
44 read_buffer_(new IOBufferWithSize(kReadBufferSize)), | 44 read_buffer_(new IOBufferWithSize(kReadBufferSize)), |
45 weak_factory_(this) { | 45 weak_factory_(this) { |
46 Initialize(); | 46 Initialize(); |
47 } | 47 } |
48 | 48 |
49 void QuicServer::Initialize() { | 49 void QuicServer::Initialize() { |
| 50 #if MMSG_MORE |
| 51 use_recvmmsg_ = true; |
| 52 #endif |
| 53 |
| 54 // If an initial flow control window has not explicitly been set, then use a |
| 55 // sensible value for a server: 1 MB for session, 64 KB for each stream. |
| 56 const uint32 kInitialSessionFlowControlWindow = 1 * 1024 * 1024; // 1 MB |
| 57 const uint32 kInitialStreamFlowControlWindow = 64 * 1024; // 64 KB |
| 58 if (config_.GetInitialFlowControlWindowToSend() == |
| 59 kMinimumFlowControlSendWindow) { |
| 60 config_.SetInitialFlowControlWindowToSend(kInitialSessionFlowControlWindow); |
| 61 } |
| 62 if (config_.GetInitialStreamFlowControlWindowToSend() == |
| 63 kMinimumFlowControlSendWindow) { |
| 64 config_.SetInitialStreamFlowControlWindowToSend( |
| 65 kInitialStreamFlowControlWindow); |
| 66 } |
| 67 if (config_.GetInitialSessionFlowControlWindowToSend() == |
| 68 kMinimumFlowControlSendWindow) { |
| 69 config_.SetInitialSessionFlowControlWindowToSend( |
| 70 kInitialSessionFlowControlWindow); |
| 71 } |
| 72 |
50 // Initialize the in memory cache now. | 73 // Initialize the in memory cache now. |
51 QuicInMemoryCache::GetInstance(); | 74 QuicInMemoryCache::GetInstance(); |
52 | 75 |
53 scoped_ptr<CryptoHandshakeMessage> scfg( | 76 scoped_ptr<CryptoHandshakeMessage> scfg( |
54 crypto_config_.AddDefaultConfig( | 77 crypto_config_.AddDefaultConfig( |
55 helper_.GetRandomGenerator(), helper_.GetClock(), | 78 helper_.GetRandomGenerator(), helper_.GetClock(), |
56 QuicCryptoServerConfig::ConfigOptions())); | 79 QuicCryptoServerConfig::ConfigOptions())); |
57 } | 80 } |
58 | 81 |
59 QuicServer::~QuicServer() { | 82 QuicServer::~QuicServer() { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 return; | 187 return; |
165 } | 188 } |
166 | 189 |
167 QuicEncryptedPacket packet(read_buffer_->data(), result, false); | 190 QuicEncryptedPacket packet(read_buffer_->data(), result, false); |
168 dispatcher_->ProcessPacket(server_address_, client_address_, packet); | 191 dispatcher_->ProcessPacket(server_address_, client_address_, packet); |
169 | 192 |
170 StartReading(); | 193 StartReading(); |
171 } | 194 } |
172 | 195 |
173 } // namespace net | 196 } // namespace net |
OLD | NEW |