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

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

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « net/quic/quic_server.cc ('k') | net/quic/quic_server_id.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4 //
5 // A binary wrapper for QuicServer. It listens forever on --port
6 // (default 6121) until it's killed or ctrl-cd to death.
7
8 #include <iostream>
9
10 #include "base/at_exit.h"
11 #include "base/basictypes.h"
12 #include "base/command_line.h"
13 #include "base/logging.h"
14 #include "base/run_loop.h"
15 #include "base/strings/string_number_conversions.h"
16 #include "net/base/ip_endpoint.h"
17 #include "net/quic/quic_in_memory_cache.h"
18 #include "net/quic/quic_protocol.h"
19 #include "net/quic/quic_server.h"
20
21 // The port the quic server will listen on.
22 int32 FLAGS_port = 6121;
23
24 int main(int argc, char *argv[]) {
25 base::CommandLine::Init(argc, argv);
26 base::CommandLine* line = base::CommandLine::ForCurrentProcess();
27
28 logging::LoggingSettings settings;
29 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
30 CHECK(logging::InitLogging(settings));
31
32 if (line->HasSwitch("h") || line->HasSwitch("help")) {
33 const char* help_str =
34 "Usage: quic_server [options]\n"
35 "\n"
36 "Options:\n"
37 "-h, --help show this help message and exit\n"
38 "--port=<port> specify the port to listen on\n"
39 "--quic_in_memory_cache_dir directory containing response data\n"
40 " to load\n";
41 std::cout << help_str;
42 exit(0);
43 }
44
45 if (line->HasSwitch("quic_in_memory_cache_dir")) {
46 net::g_quic_in_memory_cache_dir =
47 line->GetSwitchValueNative("quic_in_memory_cache_dir");
48 }
49
50 if (line->HasSwitch("port")) {
51 int port;
52 if (base::StringToInt(line->GetSwitchValueASCII("port"), &port)) {
53 FLAGS_port = port;
54 }
55 }
56
57 base::AtExitManager exit_manager;
58 base::MessageLoopForIO message_loop;
59
60 net::IPAddressNumber ip;
61 CHECK(net::ParseIPLiteralToNumber("::", &ip));
62
63 net::QuicConfig config;
64 net::QuicServer server(config, net::QuicSupportedVersions());
65
66 int rc = server.Listen(net::IPEndPoint(ip, FLAGS_port));
67 if (rc < 0) {
68 return 1;
69 }
70
71 base::RunLoop().Run();
72
73 return 0;
74 }
OLDNEW
« no previous file with comments | « net/quic/quic_server.cc ('k') | net/quic/quic_server_id.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698