OLD | NEW |
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. | 5 // A binary wrapper for QuicClient. |
6 // Connects to a host using QUIC, and sends requests to the provided URLS. | 6 // Connects to a host using QUIC, and sends requests to the provided URLS. |
7 // | 7 // |
8 // Example usage: | 8 // Example usage: |
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 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 versions = net::QuicSupportedVersions(); | 110 versions = net::QuicSupportedVersions(); |
111 } else { | 111 } else { |
112 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); | 112 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); |
113 } | 113 } |
114 | 114 |
115 // Build the client, and try to connect. | 115 // Build the client, and try to connect. |
116 VLOG(1) << "Conecting to " << FLAGS_hostname << ":" << FLAGS_port | 116 VLOG(1) << "Conecting to " << FLAGS_hostname << ":" << FLAGS_port |
117 << " with supported versions " | 117 << " with supported versions " |
118 << QuicVersionVectorToString(versions); | 118 << QuicVersionVectorToString(versions); |
119 net::EpollServer epoll_server; | 119 net::EpollServer epoll_server; |
120 net::QuicConfig config; | |
121 | |
122 // The default flow control window of 16 Kb is too small for practical | |
123 // purposes. Set it to the specified value, which has a large default. | |
124 config.SetInitialFlowControlWindowToSend( | |
125 FLAGS_flow_control_window_bytes); | |
126 config.SetInitialStreamFlowControlWindowToSend( | |
127 FLAGS_flow_control_window_bytes); | |
128 config.SetInitialSessionFlowControlWindowToSend( | |
129 FLAGS_flow_control_window_bytes); | |
130 | 120 |
131 net::tools::QuicClient client( | 121 net::tools::QuicClient client( |
132 net::IPEndPoint(addr, FLAGS_port), | 122 net::IPEndPoint(addr, FLAGS_port), |
133 net::QuicServerId(FLAGS_hostname, FLAGS_port, FLAGS_secure, | 123 net::QuicServerId(FLAGS_hostname, FLAGS_port, FLAGS_secure, |
134 net::PRIVACY_MODE_DISABLED), | 124 net::PRIVACY_MODE_DISABLED), |
135 versions, true, config, &epoll_server); | 125 versions, true, &epoll_server); |
136 | 126 |
137 client.Initialize(); | 127 client.Initialize(); |
138 | 128 |
139 if (!client.Connect()) { | 129 if (!client.Connect()) { |
140 LOG(ERROR) << "Client failed to connect to host: " | 130 LOG(ERROR) << "Client failed to connect to host: " |
141 << FLAGS_hostname << ":" << FLAGS_port; | 131 << FLAGS_hostname << ":" << FLAGS_port; |
142 return 1; | 132 return 1; |
143 } | 133 } |
144 | 134 |
145 // Send a GET request for each supplied url. | 135 // Send a GET request for each supplied url. |
146 client.SendRequestsAndWaitForResponse(urls); | 136 client.SendRequestsAndWaitForResponse(urls); |
147 return 0; | 137 return 0; |
148 } | 138 } |
OLD | NEW |