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

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

Issue 19858003: * Removed QuicTag kQuicVersion1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed comments from rch Created 7 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 | 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 13 matching lines...) Expand all
24 #ifndef SO_RXQ_OVFL 24 #ifndef SO_RXQ_OVFL
25 #define SO_RXQ_OVFL 40 25 #define SO_RXQ_OVFL 40
26 #endif 26 #endif
27 27
28 namespace net { 28 namespace net {
29 namespace tools { 29 namespace tools {
30 30
31 const int kEpollFlags = EPOLLIN | EPOLLOUT | EPOLLET; 31 const int kEpollFlags = EPOLLIN | EPOLLOUT | EPOLLET;
32 32
33 QuicClient::QuicClient(IPEndPoint server_address, 33 QuicClient::QuicClient(IPEndPoint server_address,
34 const string& server_hostname) 34 const string& server_hostname,
35 const QuicVersion version)
35 : server_address_(server_address), 36 : server_address_(server_address),
36 server_hostname_(server_hostname), 37 server_hostname_(server_hostname),
37 local_port_(0), 38 local_port_(0),
38 fd_(-1), 39 fd_(-1),
39 initialized_(false), 40 initialized_(false),
40 packets_dropped_(0), 41 packets_dropped_(0),
41 overflow_supported_(false) { 42 overflow_supported_(false),
43 version_(version) {
42 config_.SetDefaults(); 44 config_.SetDefaults();
43 } 45 }
44 46
45 QuicClient::QuicClient(IPEndPoint server_address, 47 QuicClient::QuicClient(IPEndPoint server_address,
46 const string& server_hostname, 48 const string& server_hostname,
47 const QuicConfig& config) 49 const QuicConfig& config,
50 const QuicVersion version)
48 : server_address_(server_address), 51 : server_address_(server_address),
49 server_hostname_(server_hostname), 52 server_hostname_(server_hostname),
50 config_(config), 53 config_(config),
51 local_port_(0), 54 local_port_(0),
52 fd_(-1), 55 fd_(-1),
53 initialized_(false), 56 initialized_(false),
54 packets_dropped_(0), 57 packets_dropped_(0),
55 overflow_supported_(false) { 58 overflow_supported_(false),
59 version_(version) {
56 } 60 }
57 61
58 QuicClient::~QuicClient() { 62 QuicClient::~QuicClient() {
59 if (connected()) { 63 if (connected()) {
60 session()->connection()->SendConnectionClosePacket( 64 session()->connection()->SendConnectionClosePacket(
61 QUIC_PEER_GOING_AWAY, ""); 65 QUIC_PEER_GOING_AWAY, "");
62 } 66 }
63 } 67 }
64 68
65 bool QuicClient::Initialize() { 69 bool QuicClient::Initialize() {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 149
146 bool QuicClient::StartConnect() { 150 bool QuicClient::StartConnect() {
147 DCHECK(!connected() && initialized_); 151 DCHECK(!connected() && initialized_);
148 152
149 QuicGuid guid = QuicRandom::GetInstance()->RandUint64(); 153 QuicGuid guid = QuicRandom::GetInstance()->RandUint64();
150 session_.reset(new QuicClientSession( 154 session_.reset(new QuicClientSession(
151 server_hostname_, 155 server_hostname_,
152 config_, 156 config_,
153 new QuicConnection(guid, server_address_, 157 new QuicConnection(guid, server_address_,
154 new QuicEpollConnectionHelper(fd_, &epoll_server_), 158 new QuicEpollConnectionHelper(fd_, &epoll_server_),
155 false), 159 false, version_),
156 &crypto_config_)); 160 &crypto_config_));
157 return session_->CryptoConnect(); 161 return session_->CryptoConnect();
158 } 162 }
159 163
160 bool QuicClient::EncryptionBeingEstablished() { 164 bool QuicClient::EncryptionBeingEstablished() {
161 return !session_->IsEncryptionEstablished() && 165 return !session_->IsEncryptionEstablished() &&
162 session_->connection()->connected(); 166 session_->connection()->connected();
163 } 167 }
164 168
165 void QuicClient::Disconnect() { 169 void QuicClient::Disconnect() {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 276 }
273 277
274 IPEndPoint client_address(client_ip, client_address_.port()); 278 IPEndPoint client_address(client_ip, client_address_.port());
275 session_->connection()->ProcessUdpPacket( 279 session_->connection()->ProcessUdpPacket(
276 client_address, server_address, packet); 280 client_address, server_address, packet);
277 return true; 281 return true;
278 } 282 }
279 283
280 } // namespace tools 284 } // namespace tools
281 } // namespace net 285 } // 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