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

Side by Side Diff: net/quic/quic_client_session.cc

Issue 1025573002: QUIC - disable QUIC if packet loss rate is bad for a connection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor comment fixes Created 5 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
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/quic/quic_client_session.h" 5 #include "net/quic/quic_client_session.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/metrics/sparse_histogram.h" 10 #include "base/metrics/sparse_histogram.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 NetLog* net_log) 164 NetLog* net_log)
165 : QuicClientSessionBase(connection, config), 165 : QuicClientSessionBase(connection, config),
166 require_confirmation_(false), 166 require_confirmation_(false),
167 stream_factory_(stream_factory), 167 stream_factory_(stream_factory),
168 socket_(socket.Pass()), 168 socket_(socket.Pass()),
169 read_buffer_(new IOBufferWithSize(kMaxPacketSize)), 169 read_buffer_(new IOBufferWithSize(kMaxPacketSize)),
170 transport_security_state_(transport_security_state), 170 transport_security_state_(transport_security_state),
171 server_info_(server_info.Pass()), 171 server_info_(server_info.Pass()),
172 read_pending_(false), 172 read_pending_(false),
173 num_total_streams_(0), 173 num_total_streams_(0),
174 number_of_handshakes_(0),
174 task_runner_(task_runner), 175 task_runner_(task_runner),
175 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), 176 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)),
176 dns_resolution_end_time_(dns_resolution_end_time), 177 dns_resolution_end_time_(dns_resolution_end_time),
177 logger_(new QuicConnectionLogger(this, connection_description, net_log_)), 178 logger_(new QuicConnectionLogger(this, connection_description, net_log_)),
178 num_packets_read_(0), 179 num_packets_read_(0),
179 going_away_(false), 180 going_away_(false),
180 weak_factory_(this) { 181 weak_factory_(this) {
181 connection->set_debug_visitor(logger_.get()); 182 connection->set_debug_visitor(logger_.get());
182 IPEndPoint address; 183 IPEndPoint address;
183 if (socket && socket->GetLocalAddress(&address) == OK && 184 if (socket && socket->GetLocalAddress(&address) == OK &&
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 return ERR_QUIC_HANDSHAKE_FAILED; 530 return ERR_QUIC_HANDSHAKE_FAILED;
530 531
531 callback_ = callback; 532 callback_ = callback;
532 return ERR_IO_PENDING; 533 return ERR_IO_PENDING;
533 } 534 }
534 535
535 int QuicClientSession::GetNumSentClientHellos() const { 536 int QuicClientSession::GetNumSentClientHellos() const {
536 return crypto_stream_->num_sent_client_hellos(); 537 return crypto_stream_->num_sent_client_hellos();
537 } 538 }
538 539
540 int QuicClientSession::PacketLossRate() const {
541 return logger_->PacketLossRate();
542 }
543
539 bool QuicClientSession::CanPool(const std::string& hostname, 544 bool QuicClientSession::CanPool(const std::string& hostname,
540 PrivacyMode privacy_mode) const { 545 PrivacyMode privacy_mode) const {
541 DCHECK(connection()->connected()); 546 DCHECK(connection()->connected());
542 if (privacy_mode != server_id_.privacy_mode()) { 547 if (privacy_mode != server_id_.privacy_mode()) {
543 // Privacy mode must always match. 548 // Privacy mode must always match.
544 return false; 549 return false;
545 } 550 }
546 SSLInfo ssl_info; 551 SSLInfo ssl_info;
547 if (!GetSSLInfo(&ssl_info) || !ssl_info.cert.get()) { 552 if (!GetSSLInfo(&ssl_info) || !ssl_info.cert.get()) {
548 // We can always pool with insecure QUIC sessions. 553 // We can always pool with insecure QUIC sessions.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 // for reading of QUIC server information from disk cache. We could use 618 // for reading of QUIC server information from disk cache. We could use
614 // this data to compare total time taken if we were to cancel the disk 619 // this data to compare total time taken if we were to cancel the disk
615 // cache read vs waiting for the read to complete. 620 // cache read vs waiting for the read to complete.
616 base::TimeTicks wait_for_data_start_time = 621 base::TimeTicks wait_for_data_start_time =
617 server_info_->wait_for_data_start_time(); 622 server_info_->wait_for_data_start_time();
618 if (!wait_for_data_start_time.is_null()) { 623 if (!wait_for_data_start_time.is_null()) {
619 UMA_HISTOGRAM_TIMES( 624 UMA_HISTOGRAM_TIMES(
620 "Net.QuicServerInfo.WaitForDataReady.HandshakeConfirmedTime", 625 "Net.QuicServerInfo.WaitForDataReady.HandshakeConfirmedTime",
621 base::TimeTicks::Now() - wait_for_data_start_time); 626 base::TimeTicks::Now() - wait_for_data_start_time);
622 } 627 }
628
629 // TODO(rtenneti): Handle ERROR condition from OnCryptoHandshakeCompleted.
630 ++number_of_handshakes_;
Ryan Hamilton 2015/03/21 00:04:46 I'm not sure that I understand what this member do
ramant (doing other things) 2015/03/21 03:46:05 Done.
631 stream_factory_->OnCryptoHandshakeCompleted(this, server_id_,
632 number_of_handshakes_);
623 } 633 }
634
624 // Track how long it has taken to finish handshake after we have finished 635 // Track how long it has taken to finish handshake after we have finished
625 // DNS host resolution. 636 // DNS host resolution.
626 if (!dns_resolution_end_time_.is_null()) { 637 if (!dns_resolution_end_time_.is_null()) {
627 UMA_HISTOGRAM_TIMES( 638 UMA_HISTOGRAM_TIMES(
628 "Net.QuicSession.HostResolution.HandshakeConfirmedTime", 639 "Net.QuicSession.HostResolution.HandshakeConfirmedTime",
629 base::TimeTicks::Now() - dns_resolution_end_time_); 640 base::TimeTicks::Now() - dns_resolution_end_time_);
630 } 641 }
631 642
632 ObserverSet::iterator it = observers_.begin(); 643 ObserverSet::iterator it = observers_.begin();
633 while (it != observers_.end()) { 644 while (it != observers_.end()) {
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 stream_factory_->OnSessionClosed(this); 950 stream_factory_->OnSessionClosed(this);
940 } 951 }
941 952
942 void QuicClientSession::OnConnectTimeout() { 953 void QuicClientSession::OnConnectTimeout() {
943 DCHECK(callback_.is_null()); 954 DCHECK(callback_.is_null());
944 DCHECK(IsEncryptionEstablished()); 955 DCHECK(IsEncryptionEstablished());
945 956
946 if (IsCryptoHandshakeConfirmed()) 957 if (IsCryptoHandshakeConfirmed())
947 return; 958 return;
948 959
960 ++number_of_handshakes_;
961 stream_factory_->OnCryptoHandshakeCompleted(this, server_id_,
962 number_of_handshakes_);
949 // TODO(rch): re-enable this code once beta is cut. 963 // TODO(rch): re-enable this code once beta is cut.
950 // if (stream_factory_) 964 // if (stream_factory_)
951 // stream_factory_->OnSessionConnectTimeout(this); 965 // stream_factory_->OnSessionConnectTimeout(this);
952 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); 966 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED);
953 // DCHECK_EQ(0u, GetNumOpenStreams()); 967 // DCHECK_EQ(0u, GetNumOpenStreams());
954 } 968 }
955 969
956 } // namespace net 970 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698