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

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

Issue 15074007: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix for windows Created 7 years, 7 months 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 | Annotate | Revision Log
OLDNEW
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 28 matching lines...) Expand all
39 packets_dropped_(0), 39 packets_dropped_(0),
40 overflow_supported_(false), 40 overflow_supported_(false),
41 use_recvmmsg_(false), 41 use_recvmmsg_(false),
42 crypto_config_(kSourceAddressTokenSecret) { 42 crypto_config_(kSourceAddressTokenSecret) {
43 epoll_server_.set_timeout_in_us(50 * 1000); 43 epoll_server_.set_timeout_in_us(50 * 1000);
44 // Initialize the in memory cache now. 44 // Initialize the in memory cache now.
45 QuicInMemoryCache::GetInstance(); 45 QuicInMemoryCache::GetInstance();
46 46
47 // Use hardcoded crypto parameters for now. 47 // Use hardcoded crypto parameters for now.
48 config_.SetDefaults(); 48 config_.SetDefaults();
49 CryptoHandshakeMessage extra_tags;
50 config_.ToHandshakeMessage(&extra_tags);
51 QuicEpollClock clock(&epoll_server_); 49 QuicEpollClock clock(&epoll_server_);
52 50
53 scoped_ptr<CryptoHandshakeMessage> scfg( 51 scoped_ptr<CryptoHandshakeMessage> scfg(
54 crypto_config_.AddDefaultConfig( 52 crypto_config_.AddDefaultConfig(
55 QuicRandom::GetInstance(), &clock, extra_tags, 53 QuicRandom::GetInstance(), &clock,
56 QuicCryptoServerConfig::kDefaultExpiry)); 54 QuicCryptoServerConfig::kDefaultExpiry));
57 // If we were using the same config in many servers then we would have to
58 // parse a QuicConfig from config_tags here.
59 if (!config_.SetFromHandshakeMessage(*scfg)) {
60 CHECK(false) << "Crypto config could not be parsed by QuicConfig.";
61 }
62 } 55 }
63 56
64 QuicServer::~QuicServer() { 57 QuicServer::~QuicServer() {
65 } 58 }
66 59
67 bool QuicServer::Listen(const IPEndPoint& address) { 60 bool QuicServer::Listen(const IPEndPoint& address) {
68 port_ = address.port(); 61 port_ = address.port();
69 int address_family = address.GetSockAddrFamily(); 62 int address_family = address.GetSockAddrFamily();
70 fd_ = socket(address_family, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP); 63 fd_ = socket(address_family, SOCK_DGRAM | SOCK_NONBLOCK, IPPROTO_UDP);
71 if (fd_ < 0) { 64 if (fd_ < 0) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 } 192 }
200 193
201 IPEndPoint server_address(server_ip, port); 194 IPEndPoint server_address(server_ip, port);
202 dispatcher->ProcessPacket(server_address, client_address, guid, packet); 195 dispatcher->ProcessPacket(server_address, client_address, guid, packet);
203 196
204 return true; 197 return true;
205 } 198 }
206 199
207 } // namespace tools 200 } // namespace tools
208 } // namespace net 201 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_reliable_client_stream_test.cc ('k') | net/tools/quic/quic_server_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698