OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_connection_logger.h" | 5 #include "net/quic/quic_connection_logger.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/metrics/sparse_histogram.h" | 13 #include "base/metrics/sparse_histogram.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 #include "net/base/net_log.h" | 16 #include "net/base/net_log.h" |
17 #include "net/base/net_util.h" | 17 #include "net/base/net_util.h" |
18 #include "net/cert/cert_verify_result.h" | |
19 #include "net/cert/x509_certificate.h" | |
18 #include "net/quic/crypto/crypto_handshake_message.h" | 20 #include "net/quic/crypto/crypto_handshake_message.h" |
19 #include "net/quic/crypto/crypto_protocol.h" | 21 #include "net/quic/crypto/crypto_protocol.h" |
20 #include "net/quic/quic_address_mismatch.h" | 22 #include "net/quic/quic_address_mismatch.h" |
21 #include "net/quic/quic_socket_address_coder.h" | 23 #include "net/quic/quic_socket_address_coder.h" |
22 | 24 |
23 using base::StringPiece; | 25 using base::StringPiece; |
24 using std::string; | 26 using std::string; |
25 | 27 |
26 namespace net { | 28 namespace net { |
27 | 29 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
232 base::Value* NetLogQuicOnConnectionClosedCallback( | 234 base::Value* NetLogQuicOnConnectionClosedCallback( |
233 QuicErrorCode error, | 235 QuicErrorCode error, |
234 bool from_peer, | 236 bool from_peer, |
235 NetLog::LogLevel /* log_level */) { | 237 NetLog::LogLevel /* log_level */) { |
236 base::DictionaryValue* dict = new base::DictionaryValue(); | 238 base::DictionaryValue* dict = new base::DictionaryValue(); |
237 dict->SetInteger("quic_error", error); | 239 dict->SetInteger("quic_error", error); |
238 dict->SetBoolean("from_peer", from_peer); | 240 dict->SetBoolean("from_peer", from_peer); |
239 return dict; | 241 return dict; |
240 } | 242 } |
241 | 243 |
244 base::Value* NetLogQuicCertificateVerifiedCallback( | |
245 scoped_refptr<X509Certificate> cert, | |
246 NetLog::LogLevel /* log_level */) { | |
247 std::vector<std::string> dns_names; | |
248 cert->GetDNSNames(&dns_names); | |
249 base::DictionaryValue* dict = new base::DictionaryValue(); | |
250 base::ListValue* subjects = new base::ListValue(); | |
251 for (std::vector<std::string>::const_iterator it = dns_names.begin(); | |
252 it != dns_names.end(); it++) { | |
253 subjects->Append(new base::StringValue(*it)); | |
254 } | |
255 dict->Set("subjects", subjects); | |
256 return dict; | |
257 } | |
258 | |
242 void UpdatePacketGapSentHistogram(size_t num_consecutive_missing_packets) { | 259 void UpdatePacketGapSentHistogram(size_t num_consecutive_missing_packets) { |
243 UMA_HISTOGRAM_COUNTS("Net.QuicSession.PacketGapSent", | 260 UMA_HISTOGRAM_COUNTS("Net.QuicSession.PacketGapSent", |
244 num_consecutive_missing_packets); | 261 num_consecutive_missing_packets); |
245 } | 262 } |
246 | 263 |
247 void UpdatePublicResetAddressMismatchHistogram( | 264 void UpdatePublicResetAddressMismatchHistogram( |
248 const IPEndPoint& server_hello_address, | 265 const IPEndPoint& server_hello_address, |
249 const IPEndPoint& public_reset_address) { | 266 const IPEndPoint& public_reset_address) { |
250 int sample = GetAddressMismatch(server_hello_address, public_reset_address); | 267 int sample = GetAddressMismatch(server_hello_address, public_reset_address); |
251 // We are seemingly talking to an older server that does not support the | 268 // We are seemingly talking to an older server that does not support the |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
665 void QuicConnectionLogger::UpdateReceivedFrameCounts( | 682 void QuicConnectionLogger::UpdateReceivedFrameCounts( |
666 QuicStreamId stream_id, | 683 QuicStreamId stream_id, |
667 int num_frames_received, | 684 int num_frames_received, |
668 int num_duplicate_frames_received) { | 685 int num_duplicate_frames_received) { |
669 if (stream_id != kCryptoStreamId) { | 686 if (stream_id != kCryptoStreamId) { |
670 num_frames_received_ += num_frames_received; | 687 num_frames_received_ += num_frames_received; |
671 num_duplicate_frames_received_ += num_duplicate_frames_received; | 688 num_duplicate_frames_received_ += num_duplicate_frames_received; |
672 } | 689 } |
673 } | 690 } |
674 | 691 |
692 void QuicConnectionLogger::OnCertificateVerified( | |
693 const CertVerifyResult& result) { | |
694 net_log_.AddEvent( | |
695 NetLog::TYPE_QUIC_SESSION_CERTIFICATE_VERIFIED, | |
696 base::Bind(&NetLogQuicCertificateVerifiedCallback, result.verified_cert)); | |
wtc
2014/07/24 17:34:36
Nit: if we pass a const const CertVerifyResult& to
Ryan Hamilton
2014/07/24 17:45:09
Yes, I believe that's exactly what will happen.
| |
697 } | |
698 | |
675 base::HistogramBase* QuicConnectionLogger::GetPacketSequenceNumberHistogram( | 699 base::HistogramBase* QuicConnectionLogger::GetPacketSequenceNumberHistogram( |
676 const char* statistic_name) const { | 700 const char* statistic_name) const { |
677 string prefix("Net.QuicSession.PacketReceived_"); | 701 string prefix("Net.QuicSession.PacketReceived_"); |
678 return base::LinearHistogram::FactoryGet( | 702 return base::LinearHistogram::FactoryGet( |
679 prefix + statistic_name + connection_description_, | 703 prefix + statistic_name + connection_description_, |
680 1, received_packets_.size(), received_packets_.size() + 1, | 704 1, received_packets_.size(), received_packets_.size() + 1, |
681 base::HistogramBase::kUmaTargetedHistogramFlag); | 705 base::HistogramBase::kUmaTargetedHistogramFlag); |
682 } | 706 } |
683 | 707 |
684 base::HistogramBase* QuicConnectionLogger::Get6PacketHistogram( | 708 base::HistogramBase* QuicConnectionLogger::Get6PacketHistogram( |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
824 continue; | 848 continue; |
825 } | 849 } |
826 // Record some overlapping patterns, to get a better picture, since this is | 850 // Record some overlapping patterns, to get a better picture, since this is |
827 // not very expensive. | 851 // not very expensive. |
828 if (i % 3 == 0) | 852 if (i % 3 == 0) |
829 six_packet_histogram->Add(recent_6_mask); | 853 six_packet_histogram->Add(recent_6_mask); |
830 } | 854 } |
831 } | 855 } |
832 | 856 |
833 } // namespace net | 857 } // namespace net |
OLD | NEW |