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