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 // A binary wrapper for QuicServer. It listens forever on --port | 5 // A binary wrapper for QuicServer. It listens forever on --port |
6 // (default 6121) until it's killed or ctrl-cd to death. | 6 // (default 6121) until it's killed or ctrl-cd to death. |
7 | 7 |
8 #include <iostream> | 8 #include <iostream> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 "\n" | 35 "\n" |
36 "Options:\n" | 36 "Options:\n" |
37 "-h, --help show this help message and exit\n" | 37 "-h, --help show this help message and exit\n" |
38 "--port=<port> specify the port to listen on\n" | 38 "--port=<port> specify the port to listen on\n" |
39 "--quic_in_memory_cache_dir directory containing response data\n" | 39 "--quic_in_memory_cache_dir directory containing response data\n" |
40 " to load\n"; | 40 " to load\n"; |
41 std::cout << help_str; | 41 std::cout << help_str; |
42 exit(0); | 42 exit(0); |
43 } | 43 } |
44 | 44 |
| 45 base::FilePath::StringType cache_dir; |
45 if (line->HasSwitch("quic_in_memory_cache_dir")) { | 46 if (line->HasSwitch("quic_in_memory_cache_dir")) { |
46 net::g_quic_in_memory_cache_dir = | 47 cache_dir = line->GetSwitchValueNative("quic_in_memory_cache_dir"); |
47 line->GetSwitchValueNative("quic_in_memory_cache_dir"); | 48 net::g_quic_in_memory_cache_dir = &cache_dir; |
48 } | 49 } |
49 | 50 |
50 if (line->HasSwitch("port")) { | 51 if (line->HasSwitch("port")) { |
51 int port; | 52 int port; |
52 if (base::StringToInt(line->GetSwitchValueASCII("port"), &port)) { | 53 if (base::StringToInt(line->GetSwitchValueASCII("port"), &port)) { |
53 FLAGS_port = port; | 54 FLAGS_port = port; |
54 } | 55 } |
55 } | 56 } |
56 | 57 |
57 base::AtExitManager exit_manager; | 58 base::AtExitManager exit_manager; |
(...skipping 10 matching lines...) Expand all Loading... |
68 | 69 |
69 int rc = server.Listen(net::IPEndPoint(ip, FLAGS_port)); | 70 int rc = server.Listen(net::IPEndPoint(ip, FLAGS_port)); |
70 if (rc < 0) { | 71 if (rc < 0) { |
71 return 1; | 72 return 1; |
72 } | 73 } |
73 | 74 |
74 base::RunLoop().Run(); | 75 base::RunLoop().Run(); |
75 | 76 |
76 return 0; | 77 return 0; |
77 } | 78 } |
OLD | NEW |