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

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

Issue 13976007: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated copyright notice Created 7 years, 8 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_session.h » ('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 21 matching lines...) Expand all
32 QuicClient::QuicClient(IPEndPoint server_address, 32 QuicClient::QuicClient(IPEndPoint server_address,
33 const string& server_hostname) 33 const string& server_hostname)
34 : server_address_(server_address), 34 : server_address_(server_address),
35 server_hostname_(server_hostname), 35 server_hostname_(server_hostname),
36 local_port_(0), 36 local_port_(0),
37 fd_(-1), 37 fd_(-1),
38 initialized_(false), 38 initialized_(false),
39 packets_dropped_(0), 39 packets_dropped_(0),
40 overflow_supported_(false) { 40 overflow_supported_(false) {
41 epoll_server_.set_timeout_in_us(50 * 1000); 41 epoll_server_.set_timeout_in_us(50 * 1000);
42 config_.SetDefaults();
43 crypto_config_.SetDefaults();
42 } 44 }
43 45
44 QuicClient::~QuicClient() { 46 QuicClient::~QuicClient() {
45 if (connected()) { 47 if (connected()) {
46 session()->connection() 48 session()->connection()
47 ->SendConnectionClosePacket(QUIC_PEER_GOING_AWAY, std::string()); 49 ->SendConnectionClosePacket(QUIC_PEER_GOING_AWAY, std::string());
48 } 50 }
49 } 51 }
50 52
51 bool QuicClient::Initialize() { 53 bool QuicClient::Initialize() {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 WaitForEvents(); 124 WaitForEvents();
123 } 125 }
124 return session_->connection()->connected(); 126 return session_->connection()->connected();
125 } 127 }
126 128
127 129
128 bool QuicClient::StartConnect() { 130 bool QuicClient::StartConnect() {
129 DCHECK(!connected() && initialized_); 131 DCHECK(!connected() && initialized_);
130 132
131 QuicGuid guid = QuicRandom::GetInstance()->RandUint64(); 133 QuicGuid guid = QuicRandom::GetInstance()->RandUint64();
132 session_.reset(new QuicClientSession(server_hostname_, new QuicConnection( 134 session_.reset(new QuicClientSession(
133 guid, server_address_, 135 server_hostname_,
134 new QuicEpollConnectionHelper(fd_, &epoll_server_), false))); 136 config_,
137 new QuicConnection(guid, server_address_,
138 new QuicEpollConnectionHelper(fd_, &epoll_server_),
139 false),
140 &crypto_config_));
135 return session_->CryptoConnect(); 141 return session_->CryptoConnect();
136 } 142 }
137 143
138 bool QuicClient::CryptoHandshakeInProgress() { 144 bool QuicClient::CryptoHandshakeInProgress() {
139 return !session_->IsCryptoHandshakeComplete() && 145 return !session_->IsCryptoHandshakeComplete() &&
140 session_->connection()->connected(); 146 session_->connection()->connected();
141 } 147 }
142 148
143 void QuicClient::Disconnect() { 149 void QuicClient::Disconnect() {
144 DCHECK(connected()); 150 DCHECK(connected());
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 } 245 }
240 246
241 IPEndPoint client_address(client_ip, client_address_.port()); 247 IPEndPoint client_address(client_ip, client_address_.port());
242 session_->connection()->ProcessUdpPacket( 248 session_->connection()->ProcessUdpPacket(
243 client_address, server_address, packet); 249 client_address, server_address, packet);
244 return true; 250 return true;
245 } 251 }
246 252
247 } // namespace tools 253 } // namespace tools
248 } // namespace net 254 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client.h ('k') | net/tools/quic/quic_client_session.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698