Commit ebfa6db3 authored by honghaiz@chromium.org's avatar honghaiz@chromium.org

Fix the commandline handling in quic_client.

BUG=

Review URL: https://chromiumcodereview.appspot.com/15745017

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202009 0039d316-1c4b-4281-b951-d872f2087c98
parent 15cc9925
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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. // --port and requests URLs specified on the command line.
// //
// For example: // For example:
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/at_exit.h" #include "base/at_exit.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "net/base/ip_endpoint.h" #include "net/base/ip_endpoint.h"
#include "net/tools/quic/quic_client.h" #include "net/tools/quic/quic_client.h"
...@@ -20,7 +21,22 @@ std::string FLAGS_hostname = "localhost"; ...@@ -20,7 +21,22 @@ std::string FLAGS_hostname = "localhost";
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
CommandLine::Init(argc, 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; base::AtExitManager exit_manager;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment