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

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: Fixed comments for Patch Set 7 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
« no previous file with comments | « net/quic/quic_client_session.h ('k') | net/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/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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 stream_requests_.pop_front(); 586 stream_requests_.pop_front();
587 request->OnRequestCompleteSuccess(CreateOutgoingReliableStreamImpl()); 587 request->OnRequestCompleteSuccess(CreateOutgoingReliableStreamImpl());
588 } 588 }
589 589
590 if (GetNumOpenStreams() == 0) { 590 if (GetNumOpenStreams() == 0) {
591 stream_factory_->OnIdleSession(this); 591 stream_factory_->OnIdleSession(this);
592 } 592 }
593 } 593 }
594 594
595 void QuicClientSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) { 595 void QuicClientSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) {
596 if (stream_factory_ && event == HANDSHAKE_CONFIRMED &&
597 (stream_factory_->OnHandshakeConfirmed(
598 this, logger_->ReceivedPacketLossRate()))) {
599 return;
600 }
601
596 if (!callback_.is_null() && 602 if (!callback_.is_null() &&
597 (!require_confirmation_ || 603 (!require_confirmation_ ||
598 event == HANDSHAKE_CONFIRMED || event == ENCRYPTION_REESTABLISHED)) { 604 event == HANDSHAKE_CONFIRMED || event == ENCRYPTION_REESTABLISHED)) {
599 // TODO(rtenneti): Currently for all CryptoHandshakeEvent events, callback_ 605 // TODO(rtenneti): Currently for all CryptoHandshakeEvent events, callback_
600 // could be called because there are no error events in CryptoHandshakeEvent 606 // could be called because there are no error events in CryptoHandshakeEvent
601 // enum. If error events are added to CryptoHandshakeEvent, then the 607 // enum. If error events are added to CryptoHandshakeEvent, then the
602 // following code needs to changed. 608 // following code needs to changed.
603 base::ResetAndReturn(&callback_).Run(OK); 609 base::ResetAndReturn(&callback_).Run(OK);
604 } 610 }
605 if (event == HANDSHAKE_CONFIRMED) { 611 if (event == HANDSHAKE_CONFIRMED) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 result_copy->CopyFrom(verify_details_chromium->cert_verify_result); 767 result_copy->CopyFrom(verify_details_chromium->cert_verify_result);
762 cert_verify_result_.reset(result_copy); 768 cert_verify_result_.reset(result_copy);
763 pinning_failure_log_ = verify_details_chromium->pinning_failure_log; 769 pinning_failure_log_ = verify_details_chromium->pinning_failure_log;
764 logger_->OnCertificateVerified(*cert_verify_result_); 770 logger_->OnCertificateVerified(*cert_verify_result_);
765 } 771 }
766 772
767 void QuicClientSession::StartReading() { 773 void QuicClientSession::StartReading() {
768 packet_reader_.StartReading(); 774 packet_reader_.StartReading();
769 } 775 }
770 776
771 void QuicClientSession::CloseSessionOnError(int error) { 777 void QuicClientSession::CloseSessionOnError(int error,
778 QuicErrorCode quic_error) {
772 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.CloseSessionOnError", -error); 779 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.CloseSessionOnError", -error);
773 CloseSessionOnErrorInner(error, QUIC_INTERNAL_ERROR); 780 CloseSessionOnErrorInner(error, quic_error);
774 NotifyFactoryOfSessionClosed(); 781 NotifyFactoryOfSessionClosed();
775 } 782 }
776 783
777 void QuicClientSession::CloseSessionOnErrorInner(int net_error, 784 void QuicClientSession::CloseSessionOnErrorInner(int net_error,
778 QuicErrorCode quic_error) { 785 QuicErrorCode quic_error) {
779 if (!callback_.is_null()) { 786 if (!callback_.is_null()) {
780 base::ResetAndReturn(&callback_).Run(net_error); 787 base::ResetAndReturn(&callback_).Run(net_error);
781 } 788 }
782 CloseAllStreams(net_error); 789 CloseAllStreams(net_error);
783 CloseAllObservers(net_error); 790 CloseAllObservers(net_error);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 return; 917 return;
911 918
912 // TODO(rch): re-enable this code once beta is cut. 919 // TODO(rch): re-enable this code once beta is cut.
913 // if (stream_factory_) 920 // if (stream_factory_)
914 // stream_factory_->OnSessionConnectTimeout(this); 921 // stream_factory_->OnSessionConnectTimeout(this);
915 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); 922 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED);
916 // DCHECK_EQ(0u, GetNumOpenStreams()); 923 // DCHECK_EQ(0u, GetNumOpenStreams());
917 } 924 }
918 925
919 } // namespace net 926 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_client_session.h ('k') | net/quic/quic_client_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698