| 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/chromium/quic_chromium_client_session.h" | 5 #include "net/quic/chromium/quic_chromium_client_session.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 num_total_streams_(0), | 226 num_total_streams_(0), |
| 227 task_runner_(task_runner), | 227 task_runner_(task_runner), |
| 228 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), | 228 net_log_(BoundNetLog::Make(net_log, NetLog::SOURCE_QUIC_SESSION)), |
| 229 dns_resolution_end_time_(dns_resolution_end_time), | 229 dns_resolution_end_time_(dns_resolution_end_time), |
| 230 logger_(new QuicConnectionLogger(this, | 230 logger_(new QuicConnectionLogger(this, |
| 231 connection_description, | 231 connection_description, |
| 232 std::move(socket_performance_watcher), | 232 std::move(socket_performance_watcher), |
| 233 net_log_)), | 233 net_log_)), |
| 234 going_away_(false), | 234 going_away_(false), |
| 235 port_migration_detected_(false), | 235 port_migration_detected_(false), |
| 236 disabled_reason_(QUIC_DISABLED_NOT), |
| 236 token_binding_signatures_(kTokenBindingSignatureMapSize), | 237 token_binding_signatures_(kTokenBindingSignatureMapSize), |
| 237 streams_pushed_count_(0), | 238 streams_pushed_count_(0), |
| 238 streams_pushed_and_claimed_count_(0), | 239 streams_pushed_and_claimed_count_(0), |
| 239 error_code_from_rewrite_(OK), | 240 error_code_from_rewrite_(OK), |
| 240 use_error_code_from_rewrite_(false), | 241 use_error_code_from_rewrite_(false), |
| 241 weak_factory_(this) { | 242 weak_factory_(this) { |
| 242 sockets_.push_back(std::move(socket)); | 243 sockets_.push_back(std::move(socket)); |
| 243 packet_readers_.push_back(base::WrapUnique(new QuicChromiumPacketReader( | 244 packet_readers_.push_back(base::WrapUnique(new QuicChromiumPacketReader( |
| 244 sockets_.back().get(), clock, this, yield_after_packets, | 245 sockets_.back().get(), clock, this, yield_after_packets, |
| 245 yield_after_duration, net_log_))); | 246 yield_after_duration, net_log_))); |
| (...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 new_address = IPEndPoint(ConvertIPv4ToIPv4MappedIPv6(new_address.address()), | 749 new_address = IPEndPoint(ConvertIPv4ToIPv4MappedIPv6(new_address.address()), |
| 749 new_address.port()); | 750 new_address.port()); |
| 750 } | 751 } |
| 751 | 752 |
| 752 stream_factory_->MigrateSessionToNewPeerAddress(this, new_address, net_log_); | 753 stream_factory_->MigrateSessionToNewPeerAddress(this, new_address, net_log_); |
| 753 } | 754 } |
| 754 | 755 |
| 755 void QuicChromiumClientSession::OnCryptoHandshakeEvent( | 756 void QuicChromiumClientSession::OnCryptoHandshakeEvent( |
| 756 CryptoHandshakeEvent event) { | 757 CryptoHandshakeEvent event) { |
| 757 if (stream_factory_ && event == HANDSHAKE_CONFIRMED && | 758 if (stream_factory_ && event == HANDSHAKE_CONFIRMED && |
| 758 stream_factory_->OnHandshakeConfirmed(this)) { | 759 (stream_factory_->OnHandshakeConfirmed( |
| 760 this, logger_->ReceivedPacketLossRate()))) { |
| 759 return; | 761 return; |
| 760 } | 762 } |
| 761 | 763 |
| 762 if (!callback_.is_null() && | 764 if (!callback_.is_null() && |
| 763 (!require_confirmation_ || event == HANDSHAKE_CONFIRMED || | 765 (!require_confirmation_ || event == HANDSHAKE_CONFIRMED || |
| 764 event == ENCRYPTION_REESTABLISHED)) { | 766 event == ENCRYPTION_REESTABLISHED)) { |
| 765 // TODO(rtenneti): Currently for all CryptoHandshakeEvent events, callback_ | 767 // TODO(rtenneti): Currently for all CryptoHandshakeEvent events, callback_ |
| 766 // could be called because there are no error events in CryptoHandshakeEvent | 768 // could be called because there are no error events in CryptoHandshakeEvent |
| 767 // enum. If error events are added to CryptoHandshakeEvent, then the | 769 // enum. If error events are added to CryptoHandshakeEvent, then the |
| 768 // following code needs to changed. | 770 // following code needs to changed. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 if (error == QUIC_NETWORK_IDLE_TIMEOUT) { | 875 if (error == QUIC_NETWORK_IDLE_TIMEOUT) { |
| 874 UMA_HISTOGRAM_COUNTS( | 876 UMA_HISTOGRAM_COUNTS( |
| 875 "Net.QuicSession.ConnectionClose.NumOpenStreams.TimedOut", | 877 "Net.QuicSession.ConnectionClose.NumOpenStreams.TimedOut", |
| 876 GetNumOpenOutgoingStreams()); | 878 GetNumOpenOutgoingStreams()); |
| 877 // Notify the factory the connection timed out with open streams. | 879 // Notify the factory the connection timed out with open streams. |
| 878 if (GetNumOpenOutgoingStreams() > 0 && stream_factory_) { | 880 if (GetNumOpenOutgoingStreams() > 0 && stream_factory_) { |
| 879 stream_factory_->OnTimeoutWithOpenStreams(); | 881 stream_factory_->OnTimeoutWithOpenStreams(); |
| 880 } | 882 } |
| 881 if (IsCryptoHandshakeConfirmed()) { | 883 if (IsCryptoHandshakeConfirmed()) { |
| 882 if (GetNumOpenOutgoingStreams() > 0) { | 884 if (GetNumOpenOutgoingStreams() > 0) { |
| 885 disabled_reason_ = QUIC_DISABLED_TIMEOUT_WITH_OPEN_STREAMS; |
| 883 UMA_HISTOGRAM_BOOLEAN( | 886 UMA_HISTOGRAM_BOOLEAN( |
| 884 "Net.QuicSession.TimedOutWithOpenStreams.HasUnackedPackets", | 887 "Net.QuicSession.TimedOutWithOpenStreams.HasUnackedPackets", |
| 885 connection()->sent_packet_manager().HasUnackedPackets()); | 888 connection()->sent_packet_manager().HasUnackedPackets()); |
| 886 UMA_HISTOGRAM_COUNTS( | 889 UMA_HISTOGRAM_COUNTS( |
| 887 "Net.QuicSession.TimedOutWithOpenStreams.ConsecutiveRTOCount", | 890 "Net.QuicSession.TimedOutWithOpenStreams.ConsecutiveRTOCount", |
| 888 connection()->sent_packet_manager().GetConsecutiveRtoCount()); | 891 connection()->sent_packet_manager().GetConsecutiveRtoCount()); |
| 889 UMA_HISTOGRAM_COUNTS( | 892 UMA_HISTOGRAM_COUNTS( |
| 890 "Net.QuicSession.TimedOutWithOpenStreams.ConsecutiveTLPCount", | 893 "Net.QuicSession.TimedOutWithOpenStreams.ConsecutiveTLPCount", |
| 891 connection()->sent_packet_manager().GetConsecutiveTlpCount()); | 894 connection()->sent_packet_manager().GetConsecutiveTlpCount()); |
| 892 UMA_HISTOGRAM_SPARSE_SLOWLY( | 895 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 910 RecordHandshakeFailureReason(HANDSHAKE_FAILURE_BLACK_HOLE); | 913 RecordHandshakeFailureReason(HANDSHAKE_FAILURE_BLACK_HOLE); |
| 911 UMA_HISTOGRAM_SPARSE_SLOWLY( | 914 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 912 "Net.QuicSession.ConnectionClose.HandshakeFailureBlackHole.QuicError", | 915 "Net.QuicSession.ConnectionClose.HandshakeFailureBlackHole.QuicError", |
| 913 error); | 916 error); |
| 914 } else { | 917 } else { |
| 915 RecordHandshakeFailureReason(HANDSHAKE_FAILURE_UNKNOWN); | 918 RecordHandshakeFailureReason(HANDSHAKE_FAILURE_UNKNOWN); |
| 916 UMA_HISTOGRAM_SPARSE_SLOWLY( | 919 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 917 "Net.QuicSession.ConnectionClose.HandshakeFailureUnknown.QuicError", | 920 "Net.QuicSession.ConnectionClose.HandshakeFailureUnknown.QuicError", |
| 918 error); | 921 error); |
| 919 } | 922 } |
| 923 } else if (error == QUIC_PUBLIC_RESET) { |
| 924 disabled_reason_ = QUIC_DISABLED_PUBLIC_RESET_POST_HANDSHAKE; |
| 920 } | 925 } |
| 921 | 926 |
| 922 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.QuicVersion", | 927 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.QuicVersion", |
| 923 connection()->version()); | 928 connection()->version()); |
| 924 NotifyFactoryOfSessionGoingAway(); | 929 NotifyFactoryOfSessionGoingAway(); |
| 925 QuicSession::OnConnectionClosed(error, error_details, source); | 930 QuicSession::OnConnectionClosed(error, error_details, source); |
| 926 | 931 |
| 927 if (!callback_.is_null()) { | 932 if (!callback_.is_null()) { |
| 928 base::ResetAndReturn(&callback_).Run(ERR_QUIC_PROTOCOL_ERROR); | 933 base::ResetAndReturn(&callback_).Run(ERR_QUIC_PROTOCOL_ERROR); |
| 929 } | 934 } |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 } | 1227 } |
| 1223 | 1228 |
| 1224 void QuicChromiumClientSession::DeletePromised( | 1229 void QuicChromiumClientSession::DeletePromised( |
| 1225 QuicClientPromisedInfo* promised) { | 1230 QuicClientPromisedInfo* promised) { |
| 1226 if (IsOpenStream(promised->id())) | 1231 if (IsOpenStream(promised->id())) |
| 1227 streams_pushed_and_claimed_count_++; | 1232 streams_pushed_and_claimed_count_++; |
| 1228 QuicClientSessionBase::DeletePromised(promised); | 1233 QuicClientSessionBase::DeletePromised(promised); |
| 1229 } | 1234 } |
| 1230 | 1235 |
| 1231 } // namespace net | 1236 } // namespace net |
| OLD | NEW |