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

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

Issue 339803004: Introduce QUIC_VERSION_20: allowing endpoints to set different (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 | « net/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/quic_client_session_test.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 // Pass --secure to check the certificates using proof verifier. 7 // Pass --secure to check the certificates using proof verifier.
8 // Pass --initial_flow_control_window to specify the size of the initial flow 8 // Pass --initial_stream_flow_control_window to specify the size of the initial
9 // control receive window to advertise to server. 9 // stream flow control receive window to advertise to server.
10 // Pass --initial_session_flow_control_window to specify the size of the initial
11 // session flow control receive window to advertise to server.
10 // 12 //
11 // For example: 13 // For example:
12 // quic_client --address=127.0.0.1 --port=6122 --hostname=www.google.com 14 // quic_client --address=127.0.0.1 --port=6122 --hostname=www.google.com
13 // http://www.google.com/index.html http://www.google.com/favicon.ico 15 // http://www.google.com/index.html http://www.google.com/favicon.ico
14 16
15 #include <iostream> 17 #include <iostream>
16 18
17 #include "base/at_exit.h" 19 #include "base/at_exit.h"
18 #include "base/command_line.h" 20 #include "base/command_line.h"
19 #include "base/logging.h" 21 #include "base/logging.h"
20 #include "base/strings/string_number_conversions.h" 22 #include "base/strings/string_number_conversions.h"
21 #include "net/base/ip_endpoint.h" 23 #include "net/base/ip_endpoint.h"
22 #include "net/base/privacy_mode.h" 24 #include "net/base/privacy_mode.h"
23 #include "net/quic/quic_protocol.h" 25 #include "net/quic/quic_protocol.h"
24 #include "net/quic/quic_server_id.h" 26 #include "net/quic/quic_server_id.h"
25 #include "net/tools/epoll_server/epoll_server.h" 27 #include "net/tools/epoll_server/epoll_server.h"
26 #include "net/tools/quic/quic_client.h" 28 #include "net/tools/quic/quic_client.h"
27 29
28 // The port the quic client will connect to. 30 // The port the quic client will connect to.
29 int32 FLAGS_port = 6121; 31 int32 FLAGS_port = 6121;
30 std::string FLAGS_address = "127.0.0.1"; 32 std::string FLAGS_address = "127.0.0.1";
31 // The hostname the quic client will connect to. 33 // The hostname the quic client will connect to.
32 std::string FLAGS_hostname = "localhost"; 34 std::string FLAGS_hostname = "localhost";
33 // Size of the initial flow control receive window to advertise to server. 35 // Size of the initial stream flow control receive window to advertise to
34 int32 FLAGS_initial_flow_control_window = 100 * net::kMaxPacketSize; 36 // server.
37 int32 FLAGS_initial_stream_flow_control_window = 100 * net::kMaxPacketSize;
38 // Size of the initial session flow control receive window to advertise to
39 // server.
40 int32 FLAGS_initial_session_flow_control_window = 200 * net::kMaxPacketSize;
35 // Check the certificates using proof verifier. 41 // Check the certificates using proof verifier.
36 bool FLAGS_secure = false; 42 bool FLAGS_secure = false;
37 43
38 int main(int argc, char *argv[]) { 44 int main(int argc, char *argv[]) {
39 base::CommandLine::Init(argc, argv); 45 base::CommandLine::Init(argc, argv);
40 base::CommandLine* line = base::CommandLine::ForCurrentProcess(); 46 base::CommandLine* line = base::CommandLine::ForCurrentProcess();
41 47
42 logging::LoggingSettings settings; 48 logging::LoggingSettings settings;
43 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; 49 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
44 CHECK(logging::InitLogging(settings)); 50 CHECK(logging::InitLogging(settings));
(...skipping 30 matching lines...) Expand all
75 << " address: " << FLAGS_address 81 << " address: " << FLAGS_address
76 << " hostname: " << FLAGS_hostname 82 << " hostname: " << FLAGS_hostname
77 << " secure: " << FLAGS_secure; 83 << " secure: " << FLAGS_secure;
78 84
79 base::AtExitManager exit_manager; 85 base::AtExitManager exit_manager;
80 86
81 net::IPAddressNumber addr; 87 net::IPAddressNumber addr;
82 CHECK(net::ParseIPLiteralToNumber(FLAGS_address, &addr)); 88 CHECK(net::ParseIPLiteralToNumber(FLAGS_address, &addr));
83 89
84 net::QuicConfig config; 90 net::QuicConfig config;
85 config.SetInitialFlowControlWindowToSend(FLAGS_initial_flow_control_window); 91 config.SetDefaults();
92 config.SetInitialFlowControlWindowToSend(
93 FLAGS_initial_session_flow_control_window);
94 config.SetInitialStreamFlowControlWindowToSend(
95 FLAGS_initial_stream_flow_control_window);
96 config.SetInitialSessionFlowControlWindowToSend(
97 FLAGS_initial_session_flow_control_window);
86 98
87 // TODO(rjshade): Set version on command line. 99 // TODO(rjshade): Set version on command line.
88 net::EpollServer epoll_server; 100 net::EpollServer epoll_server;
89 net::tools::QuicClient client( 101 net::tools::QuicClient client(
90 net::IPEndPoint(addr, FLAGS_port), 102 net::IPEndPoint(addr, FLAGS_port),
91 net::QuicServerId(FLAGS_hostname, FLAGS_port, FLAGS_secure, 103 net::QuicServerId(FLAGS_hostname, FLAGS_port, FLAGS_secure,
92 net::PRIVACY_MODE_DISABLED), 104 net::PRIVACY_MODE_DISABLED),
93 net::QuicSupportedVersions(), true, config, &epoll_server); 105 net::QuicSupportedVersions(), true, config, &epoll_server);
94 106
95 client.Initialize(); 107 client.Initialize();
96 108
97 if (!client.Connect()) return 1; 109 if (!client.Connect()) return 1;
98 110
99 client.SendRequestsAndWaitForResponse(line->GetArgs()); 111 client.SendRequestsAndWaitForResponse(line->GetArgs());
100 return 0; 112 return 0;
101 } 113 }
OLDNEW
« no previous file with comments | « net/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/quic_client_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698