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

Side by Side Diff: net/quic/chromium/quic_stream_factory.cc

Issue 2806883002: Add QUIC_STREAM_FACTORY_JOB specific logs to track the Job's state machine. (Closed)
Patch Set: addess #3 Created 3 years, 8 months 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/log/net_log_event_type_list.h ('k') | no next file » | 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/chromium/quic_stream_factory.h" 5 #include "net/quic/chromium/quic_stream_factory.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <tuple> 8 #include <tuple>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 return OK; 520 return OK;
521 521
522 if (server_info_) 522 if (server_info_)
523 io_state_ = STATE_LOAD_SERVER_INFO; 523 io_state_ = STATE_LOAD_SERVER_INFO;
524 else 524 else
525 io_state_ = STATE_CONNECT; 525 io_state_ = STATE_CONNECT;
526 return OK; 526 return OK;
527 } 527 }
528 528
529 int QuicStreamFactory::Job::DoLoadServerInfo() { 529 int QuicStreamFactory::Job::DoLoadServerInfo() {
530 net_log_.BeginEvent(
531 NetLogEventType::QUIC_STREAM_FACTORY_JOB_LOAD_SERVER_INFO);
532
530 io_state_ = STATE_LOAD_SERVER_INFO_COMPLETE; 533 io_state_ = STATE_LOAD_SERVER_INFO_COMPLETE;
531 534
532 DCHECK(server_info_); 535 DCHECK(server_info_);
533 536
534 // To mitigate the effects of disk cache taking too long to load QUIC server 537 // To mitigate the effects of disk cache taking too long to load QUIC server
535 // information, set up a timer to cancel WaitForDataReady's callback. 538 // information, set up a timer to cancel WaitForDataReady's callback.
536 if (factory_->load_server_info_timeout_srtt_multiplier_ > 0) { 539 if (factory_->load_server_info_timeout_srtt_multiplier_ > 0) {
537 const int kMaxLoadServerInfoTimeoutMs = 50; 540 const int kMaxLoadServerInfoTimeoutMs = 50;
538 // Wait for DiskCache a maximum of 50ms. 541 // Wait for DiskCache a maximum of 50ms.
539 int64_t load_server_info_timeout_ms = 542 int64_t load_server_info_timeout_ms =
(...skipping 17 matching lines...) Expand all
557 if (rv == ERR_IO_PENDING && factory_->enable_connection_racing()) { 560 if (rv == ERR_IO_PENDING && factory_->enable_connection_racing()) {
558 // If we are waiting to load server config from the disk cache, then start 561 // If we are waiting to load server config from the disk cache, then start
559 // another job. 562 // another job.
560 started_another_job_ = true; 563 started_another_job_ = true;
561 factory_->CreateAuxilaryJob(key_, cert_verify_flags_, net_log_); 564 factory_->CreateAuxilaryJob(key_, cert_verify_flags_, net_log_);
562 } 565 }
563 return rv; 566 return rv;
564 } 567 }
565 568
566 int QuicStreamFactory::Job::DoLoadServerInfoComplete(int rv) { 569 int QuicStreamFactory::Job::DoLoadServerInfoComplete(int rv) {
570 net_log_.EndEvent(NetLogEventType::QUIC_STREAM_FACTORY_JOB_LOAD_SERVER_INFO);
567 UMA_HISTOGRAM_TIMES("Net.QuicServerInfo.DiskCacheWaitForDataReadyTime", 571 UMA_HISTOGRAM_TIMES("Net.QuicServerInfo.DiskCacheWaitForDataReadyTime",
568 base::TimeTicks::Now() - dns_resolution_end_time_); 572 base::TimeTicks::Now() - dns_resolution_end_time_);
569 573
570 if (rv != OK) 574 if (rv != OK)
571 server_info_.reset(); 575 server_info_.reset();
572 576
573 if (started_another_job_ && 577 if (started_another_job_ &&
574 (!server_info_ || server_info_->state().server_config.empty() || 578 (!server_info_ || server_info_->state().server_config.empty() ||
575 !factory_->CryptoConfigCacheIsEmpty(key_.server_id()))) { 579 !factory_->CryptoConfigCacheIsEmpty(key_.server_id()))) {
576 // If we have started another job and if we didn't load the server config 580 // If we have started another job and if we didn't load the server config
577 // from the disk cache or if we have received a new server config from the 581 // from the disk cache or if we have received a new server config from the
578 // server, then cancel the current job. 582 // server, then cancel the current job.
579 io_state_ = STATE_NONE; 583 io_state_ = STATE_NONE;
580 return ERR_CONNECTION_CLOSED; 584 return ERR_CONNECTION_CLOSED;
581 } 585 }
582 586
583 io_state_ = STATE_CONNECT; 587 io_state_ = STATE_CONNECT;
584 return OK; 588 return OK;
585 } 589 }
586 590
587 int QuicStreamFactory::Job::DoConnect() { 591 int QuicStreamFactory::Job::DoConnect() {
588 io_state_ = STATE_CONNECT_COMPLETE; 592 io_state_ = STATE_CONNECT_COMPLETE;
589 593
590 bool require_confirmation = factory_->require_confirmation() || 594 bool require_confirmation = factory_->require_confirmation() ||
591 was_alternative_service_recently_broken_; 595 was_alternative_service_recently_broken_;
596 net_log_.BeginEvent(
597 NetLogEventType::QUIC_STREAM_FACTORY_JOB_CONNECT,
598 NetLog::BoolCallback("require_confirmation", require_confirmation));
592 599
593 int rv = factory_->CreateSession( 600 int rv = factory_->CreateSession(
594 key_, cert_verify_flags_, std::move(server_info_), require_confirmation, 601 key_, cert_verify_flags_, std::move(server_info_), require_confirmation,
595 address_list_, dns_resolution_start_time_, dns_resolution_end_time_, 602 address_list_, dns_resolution_start_time_, dns_resolution_end_time_,
596 net_log_, &session_); 603 net_log_, &session_);
597 if (rv != OK) { 604 if (rv != OK) {
598 DCHECK(rv != ERR_IO_PENDING); 605 DCHECK(rv != ERR_IO_PENDING);
599 DCHECK(!session_); 606 DCHECK(!session_);
600 return rv; 607 return rv;
601 } 608 }
(...skipping 10 matching lines...) Expand all
612 619
613 if (!session_->connection()->connected() && 620 if (!session_->connection()->connected() &&
614 session_->error() == QUIC_PROOF_INVALID) { 621 session_->error() == QUIC_PROOF_INVALID) {
615 return ERR_QUIC_HANDSHAKE_FAILED; 622 return ERR_QUIC_HANDSHAKE_FAILED;
616 } 623 }
617 624
618 return rv; 625 return rv;
619 } 626 }
620 627
621 int QuicStreamFactory::Job::DoConnectComplete(int rv) { 628 int QuicStreamFactory::Job::DoConnectComplete(int rv) {
629 net_log_.EndEvent(NetLogEventType::QUIC_STREAM_FACTORY_JOB_CONNECT);
622 if (session_ && session_->error() == QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT) { 630 if (session_ && session_->error() == QUIC_CRYPTO_HANDSHAKE_STATELESS_REJECT) {
623 num_sent_client_hellos_ += session_->GetNumSentClientHellos(); 631 num_sent_client_hellos_ += session_->GetNumSentClientHellos();
624 if (num_sent_client_hellos_ >= QuicCryptoClientStream::kMaxClientHellos) 632 if (num_sent_client_hellos_ >= QuicCryptoClientStream::kMaxClientHellos)
625 return ERR_QUIC_HANDSHAKE_FAILED; 633 return ERR_QUIC_HANDSHAKE_FAILED;
626 // The handshake was rejected statelessly, so create another connection 634 // The handshake was rejected statelessly, so create another connection
627 // to resume the handshake. 635 // to resume the handshake.
628 io_state_ = STATE_CONNECT; 636 io_state_ = STATE_CONNECT;
629 return OK; 637 return OK;
630 } 638 }
631 639
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1907 // Since the session was active, there's no longer an 1915 // Since the session was active, there's no longer an
1908 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP 1916 // HttpStreamFactoryImpl::Job running which can mark it broken, unless the TCP
1909 // job also fails. So to avoid not using QUIC when we otherwise could, we mark 1917 // job also fails. So to avoid not using QUIC when we otherwise could, we mark
1910 // it as recently broken, which means that 0-RTT will be disabled but we'll 1918 // it as recently broken, which means that 0-RTT will be disabled but we'll
1911 // still race. 1919 // still race.
1912 http_server_properties_->MarkAlternativeServiceRecentlyBroken( 1920 http_server_properties_->MarkAlternativeServiceRecentlyBroken(
1913 alternative_service); 1921 alternative_service);
1914 } 1922 }
1915 1923
1916 } // namespace net 1924 } // namespace net
OLDNEW
« no previous file with comments | « net/log/net_log_event_type_list.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698