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

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

Issue 15745017: Fix the commandline handling in quic_client. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "Revised comments" 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_client_bin.cc
diff --git a/net/tools/quic/quic_client_bin.cc b/net/tools/quic/quic_client_bin.cc
index d9b2b908d6ef224b9820f7decb36b7027aa516e1..671d34e66b02028b7e5a3ea141127dabb054d5b2 100644
--- a/net/tools/quic/quic_client_bin.cc
+++ b/net/tools/quic/quic_client_bin.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// A binary wrapper for QuicClient. Connects to --hostname on
+// A binary wrapper for QuicClient. Connects to --hostname or --address on
// --port and requests URLs specified on the command line.
//
// For example:
@@ -11,6 +11,7 @@
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/logging.h"
+#include "base/strings/string_number_conversions.h"
#include "net/base/ip_endpoint.h"
#include "net/tools/quic/quic_client.h"
@@ -20,7 +21,22 @@ std::string FLAGS_hostname = "localhost";
int main(int argc, char *argv[]) {
CommandLine::Init(argc, argv);
-
+ CommandLine* line = CommandLine::ForCurrentProcess();
+ if (line->HasSwitch("port")) {
+ int port;
+ if (base::StringToInt(line->GetSwitchValueASCII("port"), &port)) {
+ FLAGS_port = port;
+ }
+ }
+ if (line->HasSwitch("address")) {
+ FLAGS_address = line->GetSwitchValueASCII("address");
+ }
+ if (line->HasSwitch("hostname")) {
+ FLAGS_hostname = line->GetSwitchValueASCII("hostname");
+ }
+ LOG(INFO) << "server port: " << FLAGS_port
+ << " address: " << FLAGS_address
+ << " hostname: " << FLAGS_hostname;
base::AtExitManager exit_manager;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698