| 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 <openssl/ssl.h> | 7 #include <openssl/ssl.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 num_total_streams_(0), | 234 num_total_streams_(0), |
| 235 task_runner_(task_runner), | 235 task_runner_(task_runner), |
| 236 net_log_(BoundNetLog::Make(net_log, NetLogSourceType::QUIC_SESSION)), | 236 net_log_(BoundNetLog::Make(net_log, NetLogSourceType::QUIC_SESSION)), |
| 237 dns_resolution_end_time_(dns_resolution_end_time), | 237 dns_resolution_end_time_(dns_resolution_end_time), |
| 238 logger_(new QuicConnectionLogger(this, | 238 logger_(new QuicConnectionLogger(this, |
| 239 connection_description, | 239 connection_description, |
| 240 std::move(socket_performance_watcher), | 240 std::move(socket_performance_watcher), |
| 241 net_log_)), | 241 net_log_)), |
| 242 going_away_(false), | 242 going_away_(false), |
| 243 port_migration_detected_(false), | 243 port_migration_detected_(false), |
| 244 disabled_reason_(QUIC_DISABLED_NOT), | |
| 245 token_binding_signatures_(kTokenBindingSignatureMapSize), | 244 token_binding_signatures_(kTokenBindingSignatureMapSize), |
| 246 streams_pushed_count_(0), | 245 streams_pushed_count_(0), |
| 247 streams_pushed_and_claimed_count_(0), | 246 streams_pushed_and_claimed_count_(0), |
| 248 migration_pending_(false), | 247 migration_pending_(false), |
| 249 weak_factory_(this) { | 248 weak_factory_(this) { |
| 250 sockets_.push_back(std::move(socket)); | 249 sockets_.push_back(std::move(socket)); |
| 251 packet_readers_.push_back(base::MakeUnique<QuicChromiumPacketReader>( | 250 packet_readers_.push_back(base::MakeUnique<QuicChromiumPacketReader>( |
| 252 sockets_.back().get(), clock, this, yield_after_packets, | 251 sockets_.back().get(), clock, this, yield_after_packets, |
| 253 yield_after_duration, net_log_)); | 252 yield_after_duration, net_log_)); |
| 254 crypto_stream_.reset( | 253 crypto_stream_.reset( |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 new_address = IPEndPoint(ConvertIPv4ToIPv4MappedIPv6(new_address.address()), | 769 new_address = IPEndPoint(ConvertIPv4ToIPv4MappedIPv6(new_address.address()), |
| 771 new_address.port()); | 770 new_address.port()); |
| 772 } | 771 } |
| 773 | 772 |
| 774 stream_factory_->MigrateSessionToNewPeerAddress(this, new_address, net_log_); | 773 stream_factory_->MigrateSessionToNewPeerAddress(this, new_address, net_log_); |
| 775 } | 774 } |
| 776 | 775 |
| 777 void QuicChromiumClientSession::OnCryptoHandshakeEvent( | 776 void QuicChromiumClientSession::OnCryptoHandshakeEvent( |
| 778 CryptoHandshakeEvent event) { | 777 CryptoHandshakeEvent event) { |
| 779 if (stream_factory_ && event == HANDSHAKE_CONFIRMED && | 778 if (stream_factory_ && event == HANDSHAKE_CONFIRMED && |
| 780 (stream_factory_->OnHandshakeConfirmed( | 779 stream_factory_->OnHandshakeConfirmed(this)) { |
| 781 this, logger_->ReceivedPacketLossRate()))) { | |
| 782 return; | 780 return; |
| 783 } | 781 } |
| 784 | 782 |
| 785 if (!callback_.is_null() && | 783 if (!callback_.is_null() && |
| 786 (!require_confirmation_ || event == HANDSHAKE_CONFIRMED || | 784 (!require_confirmation_ || event == HANDSHAKE_CONFIRMED || |
| 787 event == ENCRYPTION_REESTABLISHED)) { | 785 event == ENCRYPTION_REESTABLISHED)) { |
| 788 // TODO(rtenneti): Currently for all CryptoHandshakeEvent events, callback_ | 786 // TODO(rtenneti): Currently for all CryptoHandshakeEvent events, callback_ |
| 789 // could be called because there are no error events in CryptoHandshakeEvent | 787 // could be called because there are no error events in CryptoHandshakeEvent |
| 790 // enum. If error events are added to CryptoHandshakeEvent, then the | 788 // enum. If error events are added to CryptoHandshakeEvent, then the |
| 791 // following code needs to changed. | 789 // following code needs to changed. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 if (error == QUIC_NETWORK_IDLE_TIMEOUT) { | 894 if (error == QUIC_NETWORK_IDLE_TIMEOUT) { |
| 897 UMA_HISTOGRAM_COUNTS( | 895 UMA_HISTOGRAM_COUNTS( |
| 898 "Net.QuicSession.ConnectionClose.NumOpenStreams.TimedOut", | 896 "Net.QuicSession.ConnectionClose.NumOpenStreams.TimedOut", |
| 899 GetNumOpenOutgoingStreams()); | 897 GetNumOpenOutgoingStreams()); |
| 900 // Notify the factory the connection timed out with open streams. | 898 // Notify the factory the connection timed out with open streams. |
| 901 if (GetNumOpenOutgoingStreams() > 0 && stream_factory_) { | 899 if (GetNumOpenOutgoingStreams() > 0 && stream_factory_) { |
| 902 stream_factory_->OnTimeoutWithOpenStreams(); | 900 stream_factory_->OnTimeoutWithOpenStreams(); |
| 903 } | 901 } |
| 904 if (IsCryptoHandshakeConfirmed()) { | 902 if (IsCryptoHandshakeConfirmed()) { |
| 905 if (GetNumOpenOutgoingStreams() > 0) { | 903 if (GetNumOpenOutgoingStreams() > 0) { |
| 906 disabled_reason_ = QUIC_DISABLED_TIMEOUT_WITH_OPEN_STREAMS; | |
| 907 UMA_HISTOGRAM_BOOLEAN( | 904 UMA_HISTOGRAM_BOOLEAN( |
| 908 "Net.QuicSession.TimedOutWithOpenStreams.HasUnackedPackets", | 905 "Net.QuicSession.TimedOutWithOpenStreams.HasUnackedPackets", |
| 909 connection()->sent_packet_manager().HasUnackedPackets()); | 906 connection()->sent_packet_manager().HasUnackedPackets()); |
| 910 UMA_HISTOGRAM_COUNTS( | 907 UMA_HISTOGRAM_COUNTS( |
| 911 "Net.QuicSession.TimedOutWithOpenStreams.ConsecutiveRTOCount", | 908 "Net.QuicSession.TimedOutWithOpenStreams.ConsecutiveRTOCount", |
| 912 connection()->sent_packet_manager().GetConsecutiveRtoCount()); | 909 connection()->sent_packet_manager().GetConsecutiveRtoCount()); |
| 913 UMA_HISTOGRAM_COUNTS( | 910 UMA_HISTOGRAM_COUNTS( |
| 914 "Net.QuicSession.TimedOutWithOpenStreams.ConsecutiveTLPCount", | 911 "Net.QuicSession.TimedOutWithOpenStreams.ConsecutiveTLPCount", |
| 915 connection()->sent_packet_manager().GetConsecutiveTlpCount()); | 912 connection()->sent_packet_manager().GetConsecutiveTlpCount()); |
| 916 UMA_HISTOGRAM_SPARSE_SLOWLY( | 913 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| (...skipping 17 matching lines...) Expand all Loading... |
| 934 RecordHandshakeFailureReason(HANDSHAKE_FAILURE_BLACK_HOLE); | 931 RecordHandshakeFailureReason(HANDSHAKE_FAILURE_BLACK_HOLE); |
| 935 UMA_HISTOGRAM_SPARSE_SLOWLY( | 932 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 936 "Net.QuicSession.ConnectionClose.HandshakeFailureBlackHole.QuicError", | 933 "Net.QuicSession.ConnectionClose.HandshakeFailureBlackHole.QuicError", |
| 937 error); | 934 error); |
| 938 } else { | 935 } else { |
| 939 RecordHandshakeFailureReason(HANDSHAKE_FAILURE_UNKNOWN); | 936 RecordHandshakeFailureReason(HANDSHAKE_FAILURE_UNKNOWN); |
| 940 UMA_HISTOGRAM_SPARSE_SLOWLY( | 937 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 941 "Net.QuicSession.ConnectionClose.HandshakeFailureUnknown.QuicError", | 938 "Net.QuicSession.ConnectionClose.HandshakeFailureUnknown.QuicError", |
| 942 error); | 939 error); |
| 943 } | 940 } |
| 944 } else if (error == QUIC_PUBLIC_RESET) { | |
| 945 disabled_reason_ = QUIC_DISABLED_PUBLIC_RESET_POST_HANDSHAKE; | |
| 946 } | 941 } |
| 947 | 942 |
| 948 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.QuicVersion", | 943 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.QuicVersion", |
| 949 connection()->version()); | 944 connection()->version()); |
| 950 NotifyFactoryOfSessionGoingAway(); | 945 NotifyFactoryOfSessionGoingAway(); |
| 951 QuicSession::OnConnectionClosed(error, error_details, source); | 946 QuicSession::OnConnectionClosed(error, error_details, source); |
| 952 | 947 |
| 953 if (!callback_.is_null()) { | 948 if (!callback_.is_null()) { |
| 954 base::ResetAndReturn(&callback_).Run(ERR_QUIC_PROTOCOL_ERROR); | 949 base::ResetAndReturn(&callback_).Run(ERR_QUIC_PROTOCOL_ERROR); |
| 955 } | 950 } |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 } | 1374 } |
| 1380 | 1375 |
| 1381 void QuicChromiumClientSession::DeletePromised( | 1376 void QuicChromiumClientSession::DeletePromised( |
| 1382 QuicClientPromisedInfo* promised) { | 1377 QuicClientPromisedInfo* promised) { |
| 1383 if (IsOpenStream(promised->id())) | 1378 if (IsOpenStream(promised->id())) |
| 1384 streams_pushed_and_claimed_count_++; | 1379 streams_pushed_and_claimed_count_++; |
| 1385 QuicClientSessionBase::DeletePromised(promised); | 1380 QuicClientSessionBase::DeletePromised(promised); |
| 1386 } | 1381 } |
| 1387 | 1382 |
| 1388 } // namespace net | 1383 } // namespace net |
| OLD | NEW |