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

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

Issue 1811043002: Landing Recent QUIC changes until 2016-03-15 16:26 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add an export clause. Created 4 years, 9 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_client.h ('k') | net/tools/quic/quic_client_session_test.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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 supported_versions, 67 supported_versions,
68 config, 68 config,
69 new QuicEpollConnectionHelper(epoll_server), 69 new QuicEpollConnectionHelper(epoll_server),
70 proof_verifier), 70 proof_verifier),
71 server_address_(server_address), 71 server_address_(server_address),
72 local_port_(0), 72 local_port_(0),
73 epoll_server_(epoll_server), 73 epoll_server_(epoll_server),
74 initialized_(false), 74 initialized_(false),
75 packets_dropped_(0), 75 packets_dropped_(0),
76 overflow_supported_(false), 76 overflow_supported_(false),
77 use_recvmmsg_(false),
78 store_response_(false), 77 store_response_(false),
79 latest_response_code_(-1), 78 latest_response_code_(-1),
80 packet_reader_(new QuicPacketReader()) {} 79 packet_reader_(new QuicPacketReader()) {}
81 80
82 QuicClient::~QuicClient() { 81 QuicClient::~QuicClient() {
83 if (connected()) { 82 if (connected()) {
84 session()->connection()->SendConnectionCloseWithDetails( 83 session()->connection()->SendConnectionCloseWithDetails(
85 QUIC_PEER_GOING_AWAY, "Client being torn down"); 84 QUIC_PEER_GOING_AWAY, "Client being torn down");
86 } 85 }
87 86
88 STLDeleteElements(&data_to_resend_on_connect_); 87 STLDeleteElements(&data_to_resend_on_connect_);
89 STLDeleteElements(&data_sent_before_handshake_); 88 STLDeleteElements(&data_sent_before_handshake_);
90 89
91 CleanUpAllUDPSockets(); 90 CleanUpAllUDPSockets();
92 } 91 }
93 92
94 bool QuicClient::Initialize() { 93 bool QuicClient::Initialize() {
95 QuicClientBase::Initialize(); 94 QuicClientBase::Initialize();
96 95
97 #if MMSG_MORE
98 use_recvmmsg_ = true;
99 #endif
100
101 set_num_sent_client_hellos(0); 96 set_num_sent_client_hellos(0);
102 set_num_stateless_rejects_received(0); 97 set_num_stateless_rejects_received(0);
103 set_connection_error(QUIC_NO_ERROR); 98 set_connection_error(QUIC_NO_ERROR);
104 99
105 // If an initial flow control window has not explicitly been set, then use the 100 // If an initial flow control window has not explicitly been set, then use the
106 // same values that Chrome uses. 101 // same values that Chrome uses.
107 const uint32_t kSessionMaxRecvWindowSize = 15 * 1024 * 1024; // 15 MB 102 const uint32_t kSessionMaxRecvWindowSize = 15 * 1024 * 1024; // 15 MB
108 const uint32_t kStreamMaxRecvWindowSize = 6 * 1024 * 1024; // 6 MB 103 const uint32_t kStreamMaxRecvWindowSize = 6 * 1024 * 1024; // 6 MB
109 if (config()->GetInitialStreamFlowControlWindowToSend() == 104 if (config()->GetInitialStreamFlowControlWindowToSend() ==
110 kMinimumFlowControlSendWindow) { 105 kMinimumFlowControlSendWindow) {
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 383
389 return true; 384 return true;
390 } 385 }
391 386
392 void QuicClient::OnEvent(int fd, EpollEvent* event) { 387 void QuicClient::OnEvent(int fd, EpollEvent* event) {
393 DCHECK_EQ(fd, GetLatestFD()); 388 DCHECK_EQ(fd, GetLatestFD());
394 389
395 if (event->in_events & EPOLLIN) { 390 if (event->in_events & EPOLLIN) {
396 bool more_to_read = true; 391 bool more_to_read = true;
397 while (connected() && more_to_read) { 392 while (connected() && more_to_read) {
398 if (use_recvmmsg_) { 393 more_to_read = packet_reader_->ReadAndDispatchPackets(
399 more_to_read = packet_reader_->ReadAndDispatchPackets( 394 GetLatestFD(), QuicClient::GetLatestClientAddress().port(), this,
400 GetLatestFD(), QuicClient::GetLatestClientAddress().port(), this, 395 overflow_supported_ ? &packets_dropped_ : nullptr);
401 overflow_supported_ ? &packets_dropped_ : nullptr);
402 } else {
403 more_to_read = QuicPacketReader::ReadAndDispatchSinglePacket(
404 GetLatestFD(), QuicClient::GetLatestClientAddress().port(), this,
405 overflow_supported_ ? &packets_dropped_ : nullptr);
406 }
407 } 396 }
408 } 397 }
409 if (connected() && (event->in_events & EPOLLOUT)) { 398 if (connected() && (event->in_events & EPOLLOUT)) {
410 writer()->SetWritable(); 399 writer()->SetWritable();
411 session()->connection()->OnCanWrite(); 400 session()->connection()->OnCanWrite();
412 } 401 }
413 if (event->in_events & EPOLLERR) { 402 if (event->in_events & EPOLLERR) {
414 DVLOG(1) << "Epollerr"; 403 DVLOG(1) << "Epollerr";
415 } 404 }
416 } 405 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 return fd_address_map_.back().first; 484 return fd_address_map_.back().first;
496 } 485 }
497 486
498 void QuicClient::ProcessPacket(const IPEndPoint& self_address, 487 void QuicClient::ProcessPacket(const IPEndPoint& self_address,
499 const IPEndPoint& peer_address, 488 const IPEndPoint& peer_address,
500 const QuicEncryptedPacket& packet) { 489 const QuicEncryptedPacket& packet) {
501 session()->connection()->ProcessUdpPacket(self_address, peer_address, packet); 490 session()->connection()->ProcessUdpPacket(self_address, peer_address, packet);
502 } 491 }
503 492
504 } // namespace net 493 } // namespace net
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client.h ('k') | net/tools/quic/quic_client_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698