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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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; | 120 net::QuicConfig config; |
121 config.SetDefaults(); | |
122 | 121 |
123 // The default flow control window of 16 Kb is too small for practical | 122 // The default flow control window of 16 Kb is too small for practical |
124 // purposes. Set it to the specified value, which has a large default. | 123 // purposes. Set it to the specified value, which has a large default. |
125 config.SetInitialFlowControlWindowToSend( | 124 config.SetInitialFlowControlWindowToSend( |
126 FLAGS_flow_control_window_bytes); | 125 FLAGS_flow_control_window_bytes); |
127 config.SetInitialStreamFlowControlWindowToSend( | 126 config.SetInitialStreamFlowControlWindowToSend( |
128 FLAGS_flow_control_window_bytes); | 127 FLAGS_flow_control_window_bytes); |
129 config.SetInitialSessionFlowControlWindowToSend( | 128 config.SetInitialSessionFlowControlWindowToSend( |
130 FLAGS_flow_control_window_bytes); | 129 FLAGS_flow_control_window_bytes); |
131 | 130 |
132 net::tools::QuicClient client( | 131 net::tools::QuicClient client( |
133 net::IPEndPoint(addr, FLAGS_port), | 132 net::IPEndPoint(addr, FLAGS_port), |
134 net::QuicServerId(FLAGS_hostname, FLAGS_port, FLAGS_secure, | 133 net::QuicServerId(FLAGS_hostname, FLAGS_port, FLAGS_secure, |
135 net::PRIVACY_MODE_DISABLED), | 134 net::PRIVACY_MODE_DISABLED), |
136 versions, true, config, &epoll_server); | 135 versions, true, config, &epoll_server); |
137 | 136 |
138 client.Initialize(); | 137 client.Initialize(); |
139 | 138 |
140 if (!client.Connect()) { | 139 if (!client.Connect()) { |
141 LOG(ERROR) << "Client failed to connect to host: " | 140 LOG(ERROR) << "Client failed to connect to host: " |
142 << FLAGS_hostname << ":" << FLAGS_port; | 141 << FLAGS_hostname << ":" << FLAGS_port; |
143 return 1; | 142 return 1; |
144 } | 143 } |
145 | 144 |
146 // Send a GET request for each supplied url. | 145 // Send a GET request for each supplied url. |
147 client.SendRequestsAndWaitForResponse(urls); | 146 client.SendRequestsAndWaitForResponse(urls); |
148 return 0; | 147 return 0; |
149 } | 148 } |
OLD | NEW |