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

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

Issue 330333006: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix linus_tsan error - reverted the change to ConnectionMigrationClientPortChanged unitttest 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/quic_client.h ('k') | net/tools/quic/quic_client_bin.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 #include "net/tools/quic/quic_client.h" 5 #include "net/tools/quic/quic_client.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <netinet/in.h> 8 #include <netinet/in.h>
9 #include <string.h> 9 #include <string.h>
10 #include <sys/epoll.h> 10 #include <sys/epoll.h>
(...skipping 17 matching lines...) Expand all
28 #endif 28 #endif
29 29
30 namespace net { 30 namespace net {
31 namespace tools { 31 namespace tools {
32 32
33 const int kEpollFlags = EPOLLIN | EPOLLOUT | EPOLLET; 33 const int kEpollFlags = EPOLLIN | EPOLLOUT | EPOLLET;
34 34
35 QuicClient::QuicClient(IPEndPoint server_address, 35 QuicClient::QuicClient(IPEndPoint server_address,
36 const QuicServerId& server_id, 36 const QuicServerId& server_id,
37 const QuicVersionVector& supported_versions, 37 const QuicVersionVector& supported_versions,
38 bool print_response, 38 bool print_response)
39 uint32 initial_flow_control_window)
40 : server_address_(server_address), 39 : server_address_(server_address),
41 server_id_(server_id), 40 server_id_(server_id),
42 local_port_(0), 41 local_port_(0),
43 fd_(-1), 42 fd_(-1),
44 helper_(CreateQuicConnectionHelper()), 43 helper_(CreateQuicConnectionHelper()),
45 initialized_(false), 44 initialized_(false),
46 packets_dropped_(0), 45 packets_dropped_(0),
47 overflow_supported_(false), 46 overflow_supported_(false),
48 supported_versions_(supported_versions), 47 supported_versions_(supported_versions),
49 print_response_(print_response), 48 print_response_(print_response) {
50 initial_flow_control_window_(initial_flow_control_window) {
51 config_.SetDefaults(); 49 config_.SetDefaults();
52 } 50 }
53 51
54 QuicClient::QuicClient(IPEndPoint server_address, 52 QuicClient::QuicClient(IPEndPoint server_address,
55 const QuicServerId& server_id, 53 const QuicServerId& server_id,
56 const QuicConfig& config,
57 const QuicVersionVector& supported_versions, 54 const QuicVersionVector& supported_versions,
58 uint32 initial_flow_control_window) 55 bool print_response,
56 const QuicConfig& config)
59 : server_address_(server_address), 57 : server_address_(server_address),
60 server_id_(server_id), 58 server_id_(server_id),
61 config_(config), 59 config_(config),
62 local_port_(0), 60 local_port_(0),
63 fd_(-1), 61 fd_(-1),
64 helper_(CreateQuicConnectionHelper()), 62 helper_(CreateQuicConnectionHelper()),
65 initialized_(false), 63 initialized_(false),
66 packets_dropped_(0), 64 packets_dropped_(0),
67 overflow_supported_(false), 65 overflow_supported_(false),
68 supported_versions_(supported_versions), 66 supported_versions_(supported_versions),
69 print_response_(false), 67 print_response_(print_response) {
70 initial_flow_control_window_(initial_flow_control_window) {
71 } 68 }
72 69
73 QuicClient::~QuicClient() { 70 QuicClient::~QuicClient() {
74 if (connected()) { 71 if (connected()) {
75 session()->connection()->SendConnectionClosePacket( 72 session()->connection()->SendConnectionClosePacket(
76 QUIC_PEER_GOING_AWAY, ""); 73 QUIC_PEER_GOING_AWAY, "");
77 } 74 }
78 } 75 }
79 76
80 bool QuicClient::Initialize() { 77 bool QuicClient::Initialize() {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 QuicPacketWriter* writer = CreateQuicPacketWriter(); 180 QuicPacketWriter* writer = CreateQuicPacketWriter();
184 if (writer_.get() != writer) { 181 if (writer_.get() != writer) {
185 writer_.reset(writer); 182 writer_.reset(writer);
186 } 183 }
187 184
188 session_.reset(new QuicClientSession( 185 session_.reset(new QuicClientSession(
189 server_id_, 186 server_id_,
190 config_, 187 config_,
191 new QuicConnection(GenerateConnectionId(), server_address_, helper_.get(), 188 new QuicConnection(GenerateConnectionId(), server_address_, helper_.get(),
192 writer_.get(), false, supported_versions_), 189 writer_.get(), false, supported_versions_),
193 initial_flow_control_window_,
194 &crypto_config_)); 190 &crypto_config_));
195 return session_->CryptoConnect(); 191 return session_->CryptoConnect();
196 } 192 }
197 193
198 bool QuicClient::EncryptionBeingEstablished() { 194 bool QuicClient::EncryptionBeingEstablished() {
199 return !session_->IsEncryptionEstablished() && 195 return !session_->IsEncryptionEstablished() &&
200 session_->connection()->connected(); 196 session_->connection()->connected();
201 } 197 }
202 198
203 void QuicClient::Disconnect() { 199 void QuicClient::Disconnect() {
(...skipping 12 matching lines...) Expand all
216 const base::CommandLine::StringVector& args) { 212 const base::CommandLine::StringVector& args) {
217 for (size_t i = 0; i < args.size(); ++i) { 213 for (size_t i = 0; i < args.size(); ++i) {
218 BalsaHeaders headers; 214 BalsaHeaders headers;
219 headers.SetRequestFirstlineFromStringPieces("GET", args[i], "HTTP/1.1"); 215 headers.SetRequestFirstlineFromStringPieces("GET", args[i], "HTTP/1.1");
220 QuicSpdyClientStream* stream = CreateReliableClientStream(); 216 QuicSpdyClientStream* stream = CreateReliableClientStream();
221 DCHECK(stream != NULL); 217 DCHECK(stream != NULL);
222 stream->SendRequest(headers, "", true); 218 stream->SendRequest(headers, "", true);
223 stream->set_visitor(this); 219 stream->set_visitor(this);
224 } 220 }
225 221
226 while (WaitForEvents()) { } 222 while (WaitForEvents()) {}
227 } 223 }
228 224
229 QuicSpdyClientStream* QuicClient::CreateReliableClientStream() { 225 QuicSpdyClientStream* QuicClient::CreateReliableClientStream() {
230 if (!connected()) { 226 if (!connected()) {
231 return NULL; 227 return NULL;
232 } 228 }
233 229
234 return session_->CreateOutgoingDataStream(); 230 return session_->CreateOutgoingDataStream();
235 } 231 }
236 232
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 QuicEncryptedPacket packet(buf, bytes_read, false); 335 QuicEncryptedPacket packet(buf, bytes_read, false);
340 336
341 IPEndPoint client_address(client_ip, client_address_.port()); 337 IPEndPoint client_address(client_ip, client_address_.port());
342 session_->connection()->ProcessUdpPacket( 338 session_->connection()->ProcessUdpPacket(
343 client_address, server_address, packet); 339 client_address, server_address, packet);
344 return true; 340 return true;
345 } 341 }
346 342
347 } // namespace tools 343 } // namespace tools
348 } // namespace net 344 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client.h ('k') | net/tools/quic/quic_client_bin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698