Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Side by Side Diff: net/quic/quic_client_session.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_bandwidth.cc ('k') | net/quic/quic_config.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/metrics/sparse_histogram.h" 10 #include "base/metrics/sparse_histogram.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.QuicSession.ConnectRandomPortForHTTPS", 279 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.QuicSession.ConnectRandomPortForHTTPS",
280 round_trip_handshakes, 0, 3, 4); 280 round_trip_handshakes, 0, 3, 4);
281 if (require_confirmation_) { 281 if (require_confirmation_) {
282 UMA_HISTOGRAM_CUSTOM_COUNTS( 282 UMA_HISTOGRAM_CUSTOM_COUNTS(
283 "Net.QuicSession.ConnectRandomPortRequiringConfirmationForHTTPS", 283 "Net.QuicSession.ConnectRandomPortRequiringConfirmationForHTTPS",
284 round_trip_handshakes, 0, 3, 4); 284 round_trip_handshakes, 0, 3, 4);
285 } 285 }
286 } 286 }
287 } 287 }
288 const QuicConnectionStats stats = connection()->GetStats(); 288 const QuicConnectionStats stats = connection()->GetStats();
289 if (server_info_ && stats.min_rtt_us > 0) {
290 base::TimeTicks wait_for_data_start_time =
291 server_info_->wait_for_data_start_time();
292 base::TimeTicks wait_for_data_end_time =
293 server_info_->wait_for_data_end_time();
294 if (!wait_for_data_start_time.is_null() &&
295 !wait_for_data_end_time.is_null()) {
296 base::TimeDelta wait_time =
297 wait_for_data_end_time - wait_for_data_start_time;
298 const base::HistogramBase::Sample kMaxWaitToRtt = 1000;
299 base::HistogramBase::Sample wait_to_rtt =
300 static_cast<base::HistogramBase::Sample>(
301 100 * wait_time.InMicroseconds() / stats.min_rtt_us);
302 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.QuicServerInfo.WaitForDataReadyToRtt",
303 wait_to_rtt, 0, kMaxWaitToRtt, 50);
304 }
305 }
306
289 if (stats.max_sequence_reordering == 0) 307 if (stats.max_sequence_reordering == 0)
290 return; 308 return;
291 const base::HistogramBase::Sample kMaxReordering = 100; 309 const base::HistogramBase::Sample kMaxReordering = 100;
292 base::HistogramBase::Sample reordering = kMaxReordering; 310 base::HistogramBase::Sample reordering = kMaxReordering;
293 if (stats.min_rtt_us > 0) { 311 if (stats.min_rtt_us > 0) {
294 reordering = static_cast<base::HistogramBase::Sample>( 312 reordering = static_cast<base::HistogramBase::Sample>(
295 100 * stats.max_time_reordering_us / stats.min_rtt_us); 313 100 * stats.max_time_reordering_us / stats.min_rtt_us);
296 } 314 }
297 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.QuicSession.MaxReorderingTime", 315 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.QuicSession.MaxReorderingTime",
298 reordering, 0, kMaxReordering, 50); 316 reordering, 0, kMaxReordering, 50);
299 if (stats.min_rtt_us > 100 * 1000) { 317 if (stats.min_rtt_us > 100 * 1000) {
300 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.QuicSession.MaxReorderingTimeLongRtt", 318 UMA_HISTOGRAM_CUSTOM_COUNTS("Net.QuicSession.MaxReorderingTimeLongRtt",
301 reordering, 0, kMaxReordering, 50); 319 reordering, 0, kMaxReordering, 50);
302 } 320 }
303 UMA_HISTOGRAM_COUNTS("Net.QuicSession.MaxReordering", 321 UMA_HISTOGRAM_COUNTS(
304 stats.max_sequence_reordering); 322 "Net.QuicSession.MaxReordering",
323 static_cast<base::HistogramBase::Sample>(stats.max_sequence_reordering));
305 } 324 }
306 325
307 void QuicClientSession::OnStreamFrames( 326 void QuicClientSession::OnStreamFrames(
308 const std::vector<QuicStreamFrame>& frames) { 327 const std::vector<QuicStreamFrame>& frames) {
309 // Record total number of stream frames. 328 // Record total number of stream frames.
310 UMA_HISTOGRAM_COUNTS("Net.QuicNumStreamFramesInPacket", frames.size()); 329 UMA_HISTOGRAM_COUNTS("Net.QuicNumStreamFramesInPacket", frames.size());
311 330
312 // Record number of frames per stream in packet. 331 // Record number of frames per stream in packet.
313 typedef std::map<QuicStreamId, size_t> FrameCounter; 332 typedef std::map<QuicStreamId, size_t> FrameCounter;
314 FrameCounter frames_per_stream; 333 FrameCounter frames_per_stream;
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 return false; 445 return false;
427 } 446 }
428 447
429 ssl_info->cert_status = cert_verify_result_->cert_status; 448 ssl_info->cert_status = cert_verify_result_->cert_status;
430 ssl_info->cert = cert_verify_result_->verified_cert; 449 ssl_info->cert = cert_verify_result_->verified_cert;
431 450
432 // TODO(wtc): Define QUIC "cipher suites". 451 // TODO(wtc): Define QUIC "cipher suites".
433 // Report the TLS cipher suite that most closely resembles the crypto 452 // Report the TLS cipher suite that most closely resembles the crypto
434 // parameters of the QUIC connection. 453 // parameters of the QUIC connection.
435 QuicTag aead = crypto_stream_->crypto_negotiated_params().aead; 454 QuicTag aead = crypto_stream_->crypto_negotiated_params().aead;
436 int cipher_suite; 455 uint16 cipher_suite;
437 int security_bits; 456 int security_bits;
438 switch (aead) { 457 switch (aead) {
439 case kAESG: 458 case kAESG:
440 cipher_suite = 0xc02f; // TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 459 cipher_suite = 0xc02f; // TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
441 security_bits = 128; 460 security_bits = 128;
442 break; 461 break;
443 case kCC12: 462 case kCC12:
444 cipher_suite = 0xcc13; // TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 463 cipher_suite = 0xcc13; // TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
445 security_bits = 256; 464 security_bits = 256;
446 break; 465 break;
447 default: 466 default:
448 NOTREACHED(); 467 NOTREACHED();
449 return false; 468 return false;
450 } 469 }
451 int ssl_connection_status = 0; 470 int ssl_connection_status = 0;
452 ssl_connection_status |= 471 ssl_connection_status |= cipher_suite;
453 (cipher_suite & SSL_CONNECTION_CIPHERSUITE_MASK) <<
454 SSL_CONNECTION_CIPHERSUITE_SHIFT;
455 ssl_connection_status |= 472 ssl_connection_status |=
456 (SSL_CONNECTION_VERSION_QUIC & SSL_CONNECTION_VERSION_MASK) << 473 (SSL_CONNECTION_VERSION_QUIC & SSL_CONNECTION_VERSION_MASK) <<
457 SSL_CONNECTION_VERSION_SHIFT; 474 SSL_CONNECTION_VERSION_SHIFT;
458 475
459 ssl_info->public_key_hashes = cert_verify_result_->public_key_hashes; 476 ssl_info->public_key_hashes = cert_verify_result_->public_key_hashes;
460 ssl_info->is_issued_by_known_root = 477 ssl_info->is_issued_by_known_root =
461 cert_verify_result_->is_issued_by_known_root; 478 cert_verify_result_->is_issued_by_known_root;
462 479
463 ssl_info->connection_status = ssl_connection_status; 480 ssl_info->connection_status = ssl_connection_status;
464 ssl_info->client_cert_sent = false; 481 ssl_info->client_cert_sent = false;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 event == HANDSHAKE_CONFIRMED || event == ENCRYPTION_REESTABLISHED)) { 594 event == HANDSHAKE_CONFIRMED || event == ENCRYPTION_REESTABLISHED)) {
578 // TODO(rtenneti): Currently for all CryptoHandshakeEvent events, callback_ 595 // TODO(rtenneti): Currently for all CryptoHandshakeEvent events, callback_
579 // could be called because there are no error events in CryptoHandshakeEvent 596 // could be called because there are no error events in CryptoHandshakeEvent
580 // enum. If error events are added to CryptoHandshakeEvent, then the 597 // enum. If error events are added to CryptoHandshakeEvent, then the
581 // following code needs to changed. 598 // following code needs to changed.
582 base::ResetAndReturn(&callback_).Run(OK); 599 base::ResetAndReturn(&callback_).Run(OK);
583 } 600 }
584 if (event == HANDSHAKE_CONFIRMED) { 601 if (event == HANDSHAKE_CONFIRMED) {
585 UMA_HISTOGRAM_TIMES("Net.QuicSession.HandshakeConfirmedTime", 602 UMA_HISTOGRAM_TIMES("Net.QuicSession.HandshakeConfirmedTime",
586 base::TimeTicks::Now() - handshake_start_); 603 base::TimeTicks::Now() - handshake_start_);
604 if (server_info_) {
605 // Track how long it has taken to finish handshake once we start waiting
606 // for reading of QUIC server information from disk cache. We could use
607 // this data to compare total time taken if we were to cancel the disk
608 // cache read vs waiting for the read to complete.
609 base::TimeTicks wait_for_data_start_time =
610 server_info_->wait_for_data_start_time();
611 if (!wait_for_data_start_time.is_null()) {
612 UMA_HISTOGRAM_TIMES(
613 "Net.QuicServerInfo.WaitForDataReady.HandshakeConfirmedTime",
614 base::TimeTicks::Now() - wait_for_data_start_time);
615 }
616 }
617
587 ObserverSet::iterator it = observers_.begin(); 618 ObserverSet::iterator it = observers_.begin();
588 while (it != observers_.end()) { 619 while (it != observers_.end()) {
589 Observer* observer = *it; 620 Observer* observer = *it;
590 ++it; 621 ++it;
591 observer->OnCryptoHandshakeConfirmed(); 622 observer->OnCryptoHandshakeConfirmed();
592 } 623 }
593 if (server_info_) 624 if (server_info_)
594 server_info_->OnExternalCacheHit(); 625 server_info_->OnExternalCacheHit();
595 } 626 }
596 QuicSession::OnCryptoHandshakeEvent(event); 627 QuicSession::OnCryptoHandshakeEvent(event);
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 return; 932 return;
902 933
903 // TODO(rch): re-enable this code once beta is cut. 934 // TODO(rch): re-enable this code once beta is cut.
904 // if (stream_factory_) 935 // if (stream_factory_)
905 // stream_factory_->OnSessionConnectTimeout(this); 936 // stream_factory_->OnSessionConnectTimeout(this);
906 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); 937 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED);
907 // DCHECK_EQ(0u, GetNumOpenStreams()); 938 // DCHECK_EQ(0u, GetNumOpenStreams());
908 } 939 }
909 940
910 } // namespace net 941 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_bandwidth.cc ('k') | net/quic/quic_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698