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

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

Issue 1240953002: Allow QuicClient to set connection MTU before the handshake is sent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Cleanup_changes_97160447
Patch Set: Created 5 years, 5 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
« no previous file with comments | « net/tools/quic/quic_simple_client.h ('k') | net/tools/quic/quic_simple_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_simple_client.h" 5 #include "net/tools/quic/quic_simple_client.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 const QuicServerId& server_id, 42 const QuicServerId& server_id,
43 const QuicVersionVector& supported_versions, 43 const QuicVersionVector& supported_versions,
44 const QuicConfig& config) 44 const QuicConfig& config)
45 : server_address_(server_address), 45 : server_address_(server_address),
46 server_id_(server_id), 46 server_id_(server_id),
47 config_(config), 47 config_(config),
48 local_port_(0), 48 local_port_(0),
49 helper_(CreateQuicConnectionHelper()), 49 helper_(CreateQuicConnectionHelper()),
50 initialized_(false), 50 initialized_(false),
51 supported_versions_(supported_versions), 51 supported_versions_(supported_versions),
52 weak_factory_(this) { 52 initial_max_packet_length_(0),
53 } 53 weak_factory_(this) {}
54 54
55 QuicSimpleClient::~QuicSimpleClient() { 55 QuicSimpleClient::~QuicSimpleClient() {
56 if (connected()) { 56 if (connected()) {
57 session()->connection()->SendConnectionClosePacket( 57 session()->connection()->SendConnectionClosePacket(
58 QUIC_PEER_GOING_AWAY, ""); 58 QUIC_PEER_GOING_AWAY, "");
59 } 59 }
60 } 60 }
61 61
62 bool QuicSimpleClient::Initialize() { 62 bool QuicSimpleClient::Initialize() {
63 DCHECK(!initialized_); 63 DCHECK(!initialized_);
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 connection_ = new QuicConnection(GenerateConnectionId(), 161 connection_ = new QuicConnection(GenerateConnectionId(),
162 server_address_, 162 server_address_,
163 helper_.get(), 163 helper_.get(),
164 DummyPacketWriterFactory(writer_.get()), 164 DummyPacketWriterFactory(writer_.get()),
165 /* owns_writer= */ false, 165 /* owns_writer= */ false,
166 Perspective::IS_CLIENT, 166 Perspective::IS_CLIENT,
167 server_id_.is_https(), 167 server_id_.is_https(),
168 supported_versions_); 168 supported_versions_);
169 session_.reset(CreateQuicClientSession(config_, connection_, server_id_, 169 session_.reset(CreateQuicClientSession(config_, connection_, server_id_,
170 &crypto_config_)); 170 &crypto_config_));
171 if (initial_max_packet_length_ != 0) {
172 session_->connection()->set_max_packet_length(initial_max_packet_length_);
173 }
171 session_->Initialize(); 174 session_->Initialize();
172 session_->CryptoConnect(); 175 session_->CryptoConnect();
173 } 176 }
174 177
175 bool QuicSimpleClient::EncryptionBeingEstablished() { 178 bool QuicSimpleClient::EncryptionBeingEstablished() {
176 return !session_->IsEncryptionEstablished() && 179 return !session_->IsEncryptionEstablished() &&
177 session_->connection()->connected(); 180 session_->connection()->connected();
178 } 181 }
179 182
180 void QuicSimpleClient::Disconnect() { 183 void QuicSimpleClient::Disconnect() {
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 session_->connection()->ProcessUdpPacket(local_address, peer_address, packet); 329 session_->connection()->ProcessUdpPacket(local_address, peer_address, packet);
327 if (!session_->connection()->connected()) { 330 if (!session_->connection()->connected()) {
328 return false; 331 return false;
329 } 332 }
330 333
331 return true; 334 return true;
332 } 335 }
333 336
334 } // namespace tools 337 } // namespace tools
335 } // namespace net 338 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_simple_client.h ('k') | net/tools/quic/quic_simple_client_bin.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698