diff options
author | rtenneti <rtenneti@chromium.org> | 2014-09-03 14:52:11 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-03 22:53:24 +0000 |
commit | 16142b6bac36b5058f36d89e96c9f7c8ad8bf707 (patch) | |
tree | ce87c87c7591d2874bbc2b1c2e4f65018ae3ca3a /net/tools | |
parent | 0b08967cc3c1a8e6bc17921201553bb6d8a7bb90 (diff) | |
download | chromium_src-16142b6bac36b5058f36d89e96c9f7c8ad8bf707.zip chromium_src-16142b6bac36b5058f36d89e96c9f7c8ad8bf707.tar.gz chromium_src-16142b6bac36b5058f36d89e96c9f7c8ad8bf707.tar.bz2 |
Landing Recent QUIC Changes.
Remove unused QUIC_VERSION_20.
We are already speaking QUIC_VERSION_21 in the wild, and QUIC_VERSION_20
was never intended to be used. Not much code removed in this CL, but
should make end to end tests a bit faster.
Merge internal change: 74594489
https://codereview.chromium.org/532093002/
Change GetLeastUnacked() to return the next packet that could be sent
when there are no packets in flight instead of 0.
This should help solve the problem we are seeing in trace logs from
internal servers where the ack line drops to 0.
Merge internal change: 74396185
https://codereview.chromium.org/530343002/
Change IsRetransmittable to not check transmission type but instead let
ShouldDiscardPacket check it directly.
Merge internal change: 74359363
https://codereview.chromium.org/536743002/
Change the QUIC CongestionMap to be based on a vector.
Saves ~0.75% CPU when profiling.
Merge internal change: 74321352
https://codereview.chromium.org/528083004/
Some improvements to quic_client_bin.
- user can supply specific version
- added a number of comments
- added a number of descriptive ERROR logs on failure
- removed unneeded flow control options (SetDefaults covers this)
Merge internal change: 74309904
https://codereview.chromium.org/532073002/
R=rch@chromium.org
Review URL: https://codereview.chromium.org/530343003
Cr-Commit-Position: refs/heads/master@{#293208}
Diffstat (limited to 'net/tools')
-rw-r--r-- | net/tools/quic/end_to_end_test.cc | 2 | ||||
-rw-r--r-- | net/tools/quic/quic_client_bin.cc | 72 |
2 files changed, 43 insertions, 31 deletions
diff --git a/net/tools/quic/end_to_end_test.cc b/net/tools/quic/end_to_end_test.cc index 28c277f..e92516c 100644 --- a/net/tools/quic/end_to_end_test.cc +++ b/net/tools/quic/end_to_end_test.cc @@ -1327,7 +1327,7 @@ TEST_P(EndToEndTest, HeadersAndCryptoStreamsNoConnectionFlowControl) { set_server_initial_session_flow_control_receive_window(kSessionIFCW); ASSERT_TRUE(Initialize()); - if (negotiated_version_ <= QUIC_VERSION_20) { + if (negotiated_version_ < QUIC_VERSION_21) { return; } diff --git a/net/tools/quic/quic_client_bin.cc b/net/tools/quic/quic_client_bin.cc index b9ea915..e9ce928 100644 --- a/net/tools/quic/quic_client_bin.cc +++ b/net/tools/quic/quic_client_bin.cc @@ -2,16 +2,11 @@ // 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 via --address -// on --port and requests URLs specified on the command line. -// Pass --secure to check the certificates using proof verifier. -// Pass --initial_stream_flow_control_window to specify the size of the initial -// stream flow control receive window to advertise to server. -// Pass --initial_session_flow_control_window to specify the size of the initial -// session flow control receive window to advertise to server. +// A binary wrapper for QuicClient. +// Connects to a host using QUIC, and sends requests to the provided URLS. // -// For example: -// quic_client --address=127.0.0.1 --port=6122 --hostname=www.google.com +// Example usage: +// quic_client --address=127.0.0.1 --port=6122 --hostname=www.google.com \ // http://www.google.com/index.html http://www.google.com/favicon.ico #include <iostream> @@ -27,19 +22,16 @@ #include "net/tools/epoll_server/epoll_server.h" #include "net/tools/quic/quic_client.h" -// The port the quic client will connect to. -int32 FLAGS_port = 6121; std::string FLAGS_address = "127.0.0.1"; -// The hostname the quic client will connect to. +// The IP or hostname the quic client will connect to. std::string FLAGS_hostname = "localhost"; -// Size of the initial stream flow control receive window to advertise to -// server. -int32 FLAGS_initial_stream_flow_control_window = 100 * net::kMaxPacketSize; -// Size of the initial session flow control receive window to advertise to -// server. -int32 FLAGS_initial_session_flow_control_window = 200 * net::kMaxPacketSize; +// The port the quic client will connect to. +int32 FLAGS_port = 6121; // Check the certificates using proof verifier. bool FLAGS_secure = false; +// QUIC version to speak, e.g. 21. Default value of 0 means 'use the latest +// version'. +int32 FLAGS_quic_version = 0; int main(int argc, char *argv[]) { base::CommandLine::Init(argc, argv); @@ -61,7 +53,8 @@ int main(int argc, char *argv[]) { "--port=<port> specify the port to connect to\n" "--address=<address> specify the IP address to connect to\n" "--host=<host> specify the SNI hostname to use\n" - "--secure check certificates\n"; + "--secure check certificates\n" + "--quic-version=<quic version> specify QUIC version to speak\n"; std::cout << help_str; exit(0); } @@ -80,37 +73,56 @@ int main(int argc, char *argv[]) { if (line->HasSwitch("secure")) { FLAGS_secure = true; } + if (line->HasSwitch("quic-version")) { + int quic_version; + if (base::StringToInt(line->GetSwitchValueASCII("quic-version"), + &quic_version)) { + FLAGS_quic_version = quic_version; + } + } VLOG(1) << "server port: " << FLAGS_port << " address: " << FLAGS_address << " hostname: " << FLAGS_hostname - << " secure: " << FLAGS_secure; + << " secure: " << FLAGS_secure + << " quic-version: " << FLAGS_quic_version; base::AtExitManager exit_manager; + // Determine IP address to connect to from supplied hostname. net::IPAddressNumber addr; CHECK(net::ParseIPLiteralToNumber(FLAGS_address, &addr)); + // Populate version vector with all versions if none specified. + net::QuicVersionVector versions; + if (FLAGS_quic_version == 0) { + versions = net::QuicSupportedVersions(); + } else { + versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); + } + + // Build the client, and try to connect. + VLOG(1) << "Conecting to " << FLAGS_hostname << ":" << FLAGS_port + << " with supported versions " + << QuicVersionVectorToString(versions); + net::EpollServer epoll_server; net::QuicConfig config; config.SetDefaults(); - config.SetInitialFlowControlWindowToSend( - FLAGS_initial_session_flow_control_window); - config.SetInitialStreamFlowControlWindowToSend( - FLAGS_initial_stream_flow_control_window); - config.SetInitialSessionFlowControlWindowToSend( - FLAGS_initial_session_flow_control_window); - // TODO(rjshade): Set version on command line. - net::EpollServer epoll_server; net::tools::QuicClient client( net::IPEndPoint(addr, FLAGS_port), net::QuicServerId(FLAGS_hostname, FLAGS_port, FLAGS_secure, net::PRIVACY_MODE_DISABLED), - net::QuicSupportedVersions(), true, config, &epoll_server); + versions, true, config, &epoll_server); client.Initialize(); - if (!client.Connect()) return 1; + if (!client.Connect()) { + LOG(ERROR) << "Client failed to connect to host: " + << FLAGS_hostname << ":" << FLAGS_port; + return 1; + } + // Send a GET request for each supplied url. client.SendRequestsAndWaitForResponse(urls); return 0; } |