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

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

Issue 170743003: Properly initialize logging in quic_server and quic_client so (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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
« no previous file with comments | « no previous file | net/tools/quic/quic_server_bin.cc » ('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 (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 // A binary wrapper for QuicClient. Connects to --hostname via --address 5 // A binary wrapper for QuicClient. Connects to --hostname via --address
6 // on --port and requests URLs specified on the command line. 6 // on --port and requests URLs specified on the command line.
7 // 7 //
8 // For example: 8 // For example:
9 // quic_client --address=127.0.0.1 --port=6122 --hostname=www.google.com 9 // quic_client --address=127.0.0.1 --port=6122 --hostname=www.google.com
10 // http://www.google.com/index.html http://www.google.com/favicon.ico 10 // http://www.google.com/index.html http://www.google.com/favicon.ico
11 11
12 #include <iostream> 12 #include <iostream>
13 13
14 #include "base/at_exit.h" 14 #include "base/at_exit.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
18 #include "net/base/ip_endpoint.h" 18 #include "net/base/ip_endpoint.h"
19 #include "net/quic/quic_protocol.h" 19 #include "net/quic/quic_protocol.h"
20 #include "net/tools/quic/quic_client.h" 20 #include "net/tools/quic/quic_client.h"
21 21
22 int32 FLAGS_port = 6121; 22 int32 FLAGS_port = 6121;
23 std::string FLAGS_address = "127.0.0.1"; 23 std::string FLAGS_address = "127.0.0.1";
tfarina 2014/02/25 17:47:20 while you are here, you may want to change this to
24 std::string FLAGS_hostname = "localhost"; 24 std::string FLAGS_hostname = "localhost";
25 25
26 int main(int argc, char *argv[]) { 26 int main(int argc, char *argv[]) {
tfarina 2014/02/25 17:47:20 nit (not you and not related to the patch): char*
27 CommandLine::Init(argc, argv); 27 CommandLine::Init(argc, argv);
28 CommandLine* line = CommandLine::ForCurrentProcess(); 28 CommandLine* line = CommandLine::ForCurrentProcess();
29
30 logging::LoggingSettings settings;
31 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
32 CHECK(logging::InitLogging(settings));
33
29 if (line->HasSwitch("h") || line->HasSwitch("help")) { 34 if (line->HasSwitch("h") || line->HasSwitch("help")) {
30 const char* help_str = 35 const char* help_str =
31 "Usage: quic_client [options]\n" 36 "Usage: quic_client [options]\n"
32 "\n" 37 "\n"
33 "Options:\n" 38 "Options:\n"
34 "-h, --help show this help message and exit\n" 39 "-h, --help show this help message and exit\n"
35 "--port=<port> specify the port to connect to\n" 40 "--port=<port> specify the port to connect to\n"
36 "--address=<address> specify the IP address to connect to\n" 41 "--address=<address> specify the IP address to connect to\n"
37 "--host=<host> specify the SNI hostname to use\n"; 42 "--host=<host> specify the SNI hostname to use\n";
38 std::cout << help_str; 43 std::cout << help_str;
tfarina 2014/02/25 17:47:20 fprintf(stdout, help_str); might work here as well
39 exit(0); 44 exit(0);
40 } 45 }
41 if (line->HasSwitch("port")) { 46 if (line->HasSwitch("port")) {
42 int port; 47 int port;
43 if (base::StringToInt(line->GetSwitchValueASCII("port"), &port)) { 48 if (base::StringToInt(line->GetSwitchValueASCII("port"), &port)) {
44 FLAGS_port = port; 49 FLAGS_port = port;
45 } 50 }
46 } 51 }
47 if (line->HasSwitch("address")) { 52 if (line->HasSwitch("address")) {
48 FLAGS_address = line->GetSwitchValueASCII("address"); 53 FLAGS_address = line->GetSwitchValueASCII("address");
(...skipping 14 matching lines...) Expand all
63 net::IPEndPoint(addr, FLAGS_port), FLAGS_hostname, 68 net::IPEndPoint(addr, FLAGS_port), FLAGS_hostname,
64 net::QuicSupportedVersions(), true); 69 net::QuicSupportedVersions(), true);
65 70
66 client.Initialize(); 71 client.Initialize();
67 72
68 if (!client.Connect()) return 1; 73 if (!client.Connect()) return 1;
69 74
70 client.SendRequestsAndWaitForResponse(line->GetArgs()); 75 client.SendRequestsAndWaitForResponse(line->GetArgs());
71 return 0; 76 return 0;
72 } 77 }
OLDNEW
« no previous file with comments | « no previous file | net/tools/quic/quic_server_bin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698