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

Side by Side Diff: net/quic/quic_server.cc

Issue 706203003: Update from https://crrev.com/303153 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « net/quic/quic_sent_packet_manager_test.cc ('k') | net/quic/quic_server_session.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 11 matching lines...) Expand all
22 namespace net { 22 namespace net {
23 23
24 namespace { 24 namespace {
25 25
26 const char kSourceAddressTokenSecret[] = "secret"; 26 const char kSourceAddressTokenSecret[] = "secret";
27 27
28 // Allocate some extra space so we can send an error if the client goes over 28 // Allocate some extra space so we can send an error if the client goes over
29 // the limit. 29 // the limit.
30 const int kReadBufferSize = 2 * kMaxPacketSize; 30 const int kReadBufferSize = 2 * kMaxPacketSize;
31 31
32 const uint32 kServerInitialFlowControlWindow = 100 * kMaxPacketSize;
33
34 } // namespace 32 } // namespace
35 33
36 QuicServer::QuicServer(const QuicConfig& config, 34 QuicServer::QuicServer(const QuicConfig& config,
37 const QuicVersionVector& supported_versions) 35 const QuicVersionVector& supported_versions)
38 : helper_(base::MessageLoop::current()->message_loop_proxy().get(), 36 : helper_(base::MessageLoop::current()->message_loop_proxy().get(),
39 &clock_, 37 &clock_,
40 QuicRandom::GetInstance()), 38 QuicRandom::GetInstance()),
41 config_(config), 39 config_(config),
42 crypto_config_(kSourceAddressTokenSecret, QuicRandom::GetInstance()), 40 crypto_config_(kSourceAddressTokenSecret, QuicRandom::GetInstance()),
43 supported_versions_(supported_versions), 41 supported_versions_(supported_versions),
44 read_pending_(false), 42 read_pending_(false),
45 synchronous_read_count_(0), 43 synchronous_read_count_(0),
46 read_buffer_(new IOBufferWithSize(kReadBufferSize)), 44 read_buffer_(new IOBufferWithSize(kReadBufferSize)),
47 weak_factory_(this) { 45 weak_factory_(this) {
48 Initialize(); 46 Initialize();
49 } 47 }
50 48
51 void QuicServer::Initialize() { 49 void QuicServer::Initialize() {
52 // Initialize the in memory cache now. 50 // Initialize the in memory cache now.
53 QuicInMemoryCache::GetInstance(); 51 QuicInMemoryCache::GetInstance();
54 52
55 scoped_ptr<CryptoHandshakeMessage> scfg( 53 scoped_ptr<CryptoHandshakeMessage> scfg(
56 crypto_config_.AddDefaultConfig(helper_.GetRandomGenerator(), 54 crypto_config_.AddDefaultConfig(
57 helper_.GetClock(), 55 helper_.GetRandomGenerator(), helper_.GetClock(),
58 QuicCryptoServerConfig::ConfigOptions())); 56 QuicCryptoServerConfig::ConfigOptions()));
59
60 config_.SetInitialCongestionWindowToSend(kServerInitialFlowControlWindow);
61 } 57 }
62 58
63 QuicServer::~QuicServer() { 59 QuicServer::~QuicServer() {
64 } 60 }
65 61
66 int QuicServer::Listen(const IPEndPoint& address) { 62 int QuicServer::Listen(const IPEndPoint& address) {
67 scoped_ptr<UDPServerSocket> socket( 63 scoped_ptr<UDPServerSocket> socket(
68 new UDPServerSocket(&net_log_, NetLog::Source())); 64 new UDPServerSocket(&net_log_, NetLog::Source()));
69 65
70 socket->AllowAddressReuse(); 66 socket->AllowAddressReuse();
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 return; 163 return;
168 } 164 }
169 165
170 QuicEncryptedPacket packet(read_buffer_->data(), result, false); 166 QuicEncryptedPacket packet(read_buffer_->data(), result, false);
171 dispatcher_->ProcessPacket(server_address_, client_address_, packet); 167 dispatcher_->ProcessPacket(server_address_, client_address_, packet);
172 168
173 StartReading(); 169 StartReading();
174 } 170 }
175 171
176 } // namespace net 172 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager_test.cc ('k') | net/quic/quic_server_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698