Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/location.h" | 8 #include "base/location.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/metrics/sparse_histogram.h" | 10 #include "base/metrics/sparse_histogram.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 177 socket_(socket.Pass()), | 177 socket_(socket.Pass()), |
| 178 transport_security_state_(transport_security_state), | 178 transport_security_state_(transport_security_state), |
| 179 server_info_(server_info.Pass()), | 179 server_info_(server_info.Pass()), |
| 180 num_total_streams_(0), | 180 num_total_streams_(0), |
| 181 task_runner_(task_runner), | 181 task_runner_(task_runner), |
| 182 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), | 182 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), |
| 183 packet_reader_(socket_.get(), this, net_log_), | 183 packet_reader_(socket_.get(), this, net_log_), |
| 184 dns_resolution_end_time_(dns_resolution_end_time), | 184 dns_resolution_end_time_(dns_resolution_end_time), |
| 185 logger_(new QuicConnectionLogger(this, connection_description, net_log_)), | 185 logger_(new QuicConnectionLogger(this, connection_description, net_log_)), |
| 186 going_away_(false), | 186 going_away_(false), |
| 187 epitaph_(QUIC_EPITAPH_RIP), | |
| 187 weak_factory_(this) { | 188 weak_factory_(this) { |
| 188 crypto_stream_.reset( | 189 crypto_stream_.reset( |
| 189 crypto_client_stream_factory | 190 crypto_client_stream_factory |
| 190 ? crypto_client_stream_factory->CreateQuicCryptoClientStream( | 191 ? crypto_client_stream_factory->CreateQuicCryptoClientStream( |
| 191 server_id, this, crypto_config) | 192 server_id, this, crypto_config) |
| 192 : new QuicCryptoClientStream( | 193 : new QuicCryptoClientStream( |
| 193 server_id, this, | 194 server_id, this, |
| 194 new ProofVerifyContextChromium(cert_verify_flags, net_log_), | 195 new ProofVerifyContextChromium(cert_verify_flags, net_log_), |
| 195 crypto_config)); | 196 crypto_config)); |
| 196 connection->set_debug_visitor(logger_.get()); | 197 connection->set_debug_visitor(logger_.get()); |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 669 UMA_HISTOGRAM_SPARSE_SLOWLY( | 670 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 670 "Net.QuicSession.ConnectionCloseErrorCodeClient", error); | 671 "Net.QuicSession.ConnectionCloseErrorCodeClient", error); |
| 671 } | 672 } |
| 672 | 673 |
| 673 if (error == QUIC_CONNECTION_TIMED_OUT) { | 674 if (error == QUIC_CONNECTION_TIMED_OUT) { |
| 674 UMA_HISTOGRAM_COUNTS( | 675 UMA_HISTOGRAM_COUNTS( |
| 675 "Net.QuicSession.ConnectionClose.NumOpenStreams.TimedOut", | 676 "Net.QuicSession.ConnectionClose.NumOpenStreams.TimedOut", |
| 676 GetNumOpenStreams()); | 677 GetNumOpenStreams()); |
| 677 if (IsCryptoHandshakeConfirmed()) { | 678 if (IsCryptoHandshakeConfirmed()) { |
| 678 if (GetNumOpenStreams() > 0) { | 679 if (GetNumOpenStreams() > 0) { |
| 680 epitaph_ = QUIC_EPITAPH_TIMEOUT_STREAMS_OPEN; | |
| 679 UMA_HISTOGRAM_BOOLEAN( | 681 UMA_HISTOGRAM_BOOLEAN( |
| 680 "Net.QuicSession.TimedOutWithOpenStreams.HasUnackedPackets", | 682 "Net.QuicSession.TimedOutWithOpenStreams.HasUnackedPackets", |
| 681 connection()->sent_packet_manager().HasUnackedPackets()); | 683 connection()->sent_packet_manager().HasUnackedPackets()); |
| 682 UMA_HISTOGRAM_COUNTS( | 684 UMA_HISTOGRAM_COUNTS( |
| 683 "Net.QuicSession.TimedOutWithOpenStreams.ConsecutiveRTOCount", | 685 "Net.QuicSession.TimedOutWithOpenStreams.ConsecutiveRTOCount", |
| 684 connection()->sent_packet_manager().consecutive_rto_count()); | 686 connection()->sent_packet_manager().consecutive_rto_count()); |
| 685 UMA_HISTOGRAM_COUNTS( | 687 UMA_HISTOGRAM_COUNTS( |
| 686 "Net.QuicSession.TimedOutWithOpenStreams.ConsecutiveTLPCount", | 688 "Net.QuicSession.TimedOutWithOpenStreams.ConsecutiveTLPCount", |
| 687 connection()->sent_packet_manager().consecutive_tlp_count()); | 689 connection()->sent_packet_manager().consecutive_tlp_count()); |
| 688 } | 690 } |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 701 } else { | 703 } else { |
| 702 UMA_HISTOGRAM_COUNTS( | 704 UMA_HISTOGRAM_COUNTS( |
| 703 "Net.QuicSession.ConnectionClose.NumOpenStreams.HandshakeTimedOut", | 705 "Net.QuicSession.ConnectionClose.NumOpenStreams.HandshakeTimedOut", |
| 704 GetNumOpenStreams()); | 706 GetNumOpenStreams()); |
| 705 UMA_HISTOGRAM_COUNTS( | 707 UMA_HISTOGRAM_COUNTS( |
| 706 "Net.QuicSession.ConnectionClose.NumTotalStreams.HandshakeTimedOut", | 708 "Net.QuicSession.ConnectionClose.NumTotalStreams.HandshakeTimedOut", |
| 707 num_total_streams_); | 709 num_total_streams_); |
| 708 } | 710 } |
| 709 } | 711 } |
| 710 | 712 |
| 711 if (!IsCryptoHandshakeConfirmed()) { | 713 bool crypto_handshake_confirmed = IsCryptoHandshakeConfirmed(); |
| 714 if (error == QUIC_PUBLIC_RESET && crypto_handshake_confirmed) { | |
| 715 epitaph_ = QUIC_EPITAPH_PUBLIC_RESET_POST_HANDSHAKE; | |
| 716 } | |
| 717 if (!crypto_handshake_confirmed) { | |
| 712 if (error == QUIC_PUBLIC_RESET) { | 718 if (error == QUIC_PUBLIC_RESET) { |
| 713 RecordHandshakeFailureReason(HANDSHAKE_FAILURE_PUBLIC_RESET); | 719 RecordHandshakeFailureReason(HANDSHAKE_FAILURE_PUBLIC_RESET); |
| 714 } else if (connection()->GetStats().packets_received == 0) { | 720 } else if (connection()->GetStats().packets_received == 0) { |
| 715 RecordHandshakeFailureReason(HANDSHAKE_FAILURE_BLACK_HOLE); | 721 RecordHandshakeFailureReason(HANDSHAKE_FAILURE_BLACK_HOLE); |
| 716 UMA_HISTOGRAM_SPARSE_SLOWLY( | 722 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 717 "Net.QuicSession.ConnectionClose.HandshakeFailureBlackHole.QuicError", | 723 "Net.QuicSession.ConnectionClose.HandshakeFailureBlackHole.QuicError", |
| 718 error); | 724 error); |
| 719 } else { | 725 } else { |
| 720 RecordHandshakeFailureReason(HANDSHAKE_FAILURE_UNKNOWN); | 726 RecordHandshakeFailureReason(HANDSHAKE_FAILURE_UNKNOWN); |
| 721 UMA_HISTOGRAM_SPARSE_SLOWLY( | 727 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 722 "Net.QuicSession.ConnectionClose.HandshakeFailureUnknown.QuicError", | 728 "Net.QuicSession.ConnectionClose.HandshakeFailureUnknown.QuicError", |
| 723 error); | 729 error); |
| 724 } | 730 } |
| 725 } | 731 } |
|
Ryan Hamilton
2015/06/30 18:55:31
Alternatively, you could do:
} else if (error ==
Buck
2015/07/01 19:06:19
Done.
| |
| 726 | 732 |
| 727 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.QuicVersion", | 733 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.QuicVersion", |
| 728 connection()->version()); | 734 connection()->version()); |
| 729 NotifyFactoryOfSessionGoingAway(); | 735 NotifyFactoryOfSessionGoingAway(); |
| 730 if (!callback_.is_null()) { | 736 if (!callback_.is_null()) { |
| 731 base::ResetAndReturn(&callback_).Run(ERR_QUIC_PROTOCOL_ERROR); | 737 base::ResetAndReturn(&callback_).Run(ERR_QUIC_PROTOCOL_ERROR); |
| 732 } | 738 } |
| 733 socket_->Close(); | 739 socket_->Close(); |
| 734 QuicSession::OnConnectionClosed(error, from_peer); | 740 QuicSession::OnConnectionClosed(error, from_peer); |
| 735 DCHECK(dynamic_streams().empty()); | 741 DCHECK(dynamic_streams().empty()); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 930 return; | 936 return; |
| 931 | 937 |
| 932 // TODO(rch): re-enable this code once beta is cut. | 938 // TODO(rch): re-enable this code once beta is cut. |
| 933 // if (stream_factory_) | 939 // if (stream_factory_) |
| 934 // stream_factory_->OnSessionConnectTimeout(this); | 940 // stream_factory_->OnSessionConnectTimeout(this); |
| 935 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); | 941 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); |
| 936 // DCHECK_EQ(0u, GetNumOpenStreams()); | 942 // DCHECK_EQ(0u, GetNumOpenStreams()); |
| 937 } | 943 } |
| 938 | 944 |
| 939 } // namespace net | 945 } // namespace net |
| OLD | NEW |