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

Unified Diff: net/tools/quic/quic_server.cc

Issue 13976007: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated copyright notice Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/quic/quic_server.h ('k') | net/tools/quic/quic_server_session.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_server.cc
diff --git a/net/tools/quic/quic_server.cc b/net/tools/quic/quic_server.cc
index 6f761ae376c6648d04c434d17ff6bd51279fd303..4e1743a6658230f509b8557e257dda7765921ccb 100644
--- a/net/tools/quic/quic_server.cc
+++ b/net/tools/quic/quic_server.cc
@@ -12,6 +12,10 @@
#include <sys/socket.h>
#include "net/base/ip_endpoint.h"
+#include "net/quic/crypto/crypto_handshake.h"
+#include "net/quic/crypto/quic_random.h"
+#include "net/quic/quic_clock.h"
+#include "net/quic/quic_crypto_stream.h"
#include "net/quic/quic_data_reader.h"
#include "net/quic/quic_protocol.h"
#include "net/tools/quic/quic_in_memory_cache.h"
@@ -25,6 +29,7 @@
const int kEpollFlags = EPOLLIN | EPOLLOUT | EPOLLET;
const int kNumPacketsPerReadCall = 5; // Arbitrary
+static const char kSourceAddressTokenSecret[] = "secret";
namespace net {
namespace tools {
@@ -33,10 +38,26 @@ QuicServer::QuicServer()
: port_(0),
packets_dropped_(0),
overflow_supported_(false),
- use_recvmmsg_(false) {
+ use_recvmmsg_(false),
+ crypto_config_(kSourceAddressTokenSecret) {
epoll_server_.set_timeout_in_us(50 * 1000);
// Initialize the in memory cache now.
QuicInMemoryCache::GetInstance();
+
+ // Use hardcoded crypto parameters for now.
+ config_.SetDefaults();
+ CryptoHandshakeMessage extra_tags;
+ config_.ToHandshakeMessage(&extra_tags);
+ QuicEpollClock clock(&epoll_server_);
+
+ scoped_ptr<CryptoHandshakeMessage> scfg(
+ crypto_config_.AddDefaultConfig(QuicRandom::GetInstance(), &clock,
+ extra_tags));
+ // If we were using the same config in many servers then we would have to
+ // parse a QuicConfig from config_tags here.
+ if (!config_.SetFromHandshakeMessage(*scfg)) {
+ CHECK(false) << "Crypto config could not be parsed by QuicConfig.";
+ }
}
QuicServer::~QuicServer() {
@@ -109,7 +130,8 @@ bool QuicServer::Listen(const IPEndPoint& address) {
epoll_server_.RegisterFD(fd_, this, kEpollFlags);
- dispatcher_.reset(new QuicDispatcher(fd_, &epoll_server_));
+ dispatcher_.reset(new QuicDispatcher(config_, crypto_config_, fd_,
+ &epoll_server_));
return true;
}
« no previous file with comments | « net/tools/quic/quic_server.h ('k') | net/tools/quic/quic_server_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698