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

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

Issue 524463004: Adds plumbing for always requiring handshake confirmation in QUIC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More nits fixed, test added, and formatting. Created 6 years, 3 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
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_stream_factory.h" 5 #include "net/quic/quic_stream_factory.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/cpu.h" 9 #include "base/cpu.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 ChannelIDService* channel_id_service, 474 ChannelIDService* channel_id_service,
475 TransportSecurityState* transport_security_state, 475 TransportSecurityState* transport_security_state,
476 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory, 476 QuicCryptoClientStreamFactory* quic_crypto_client_stream_factory,
477 QuicRandom* random_generator, 477 QuicRandom* random_generator,
478 QuicClock* clock, 478 QuicClock* clock,
479 size_t max_packet_length, 479 size_t max_packet_length,
480 const std::string& user_agent_id, 480 const std::string& user_agent_id,
481 const QuicVersionVector& supported_versions, 481 const QuicVersionVector& supported_versions,
482 bool enable_port_selection, 482 bool enable_port_selection,
483 bool enable_time_based_loss_detection, 483 bool enable_time_based_loss_detection,
484 bool always_require_handshake_confirmation,
484 const QuicTagVector& connection_options) 485 const QuicTagVector& connection_options)
485 : require_confirmation_(true), 486 : require_confirmation_(true),
486 host_resolver_(host_resolver), 487 host_resolver_(host_resolver),
487 client_socket_factory_(client_socket_factory), 488 client_socket_factory_(client_socket_factory),
488 http_server_properties_(http_server_properties), 489 http_server_properties_(http_server_properties),
489 transport_security_state_(transport_security_state), 490 transport_security_state_(transport_security_state),
490 quic_server_info_factory_(NULL), 491 quic_server_info_factory_(NULL),
491 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory), 492 quic_crypto_client_stream_factory_(quic_crypto_client_stream_factory),
492 random_generator_(random_generator), 493 random_generator_(random_generator),
493 clock_(clock), 494 clock_(clock),
494 max_packet_length_(max_packet_length), 495 max_packet_length_(max_packet_length),
495 config_(InitializeQuicConfig(enable_time_based_loss_detection, 496 config_(InitializeQuicConfig(enable_time_based_loss_detection,
496 connection_options)), 497 connection_options)),
497 supported_versions_(supported_versions), 498 supported_versions_(supported_versions),
498 enable_port_selection_(enable_port_selection), 499 enable_port_selection_(enable_port_selection),
500 always_require_handshake_confirmation_(
501 always_require_handshake_confirmation),
499 port_seed_(random_generator_->RandUint64()), 502 port_seed_(random_generator_->RandUint64()),
500 weak_factory_(this) { 503 weak_factory_(this) {
501 DCHECK(transport_security_state_); 504 DCHECK(transport_security_state_);
502 crypto_config_.SetDefaults(); 505 crypto_config_.SetDefaults();
503 crypto_config_.set_user_agent_id(user_agent_id); 506 crypto_config_.set_user_agent_id(user_agent_id);
504 crypto_config_.AddCanonicalSuffix(".c.youtube.com"); 507 crypto_config_.AddCanonicalSuffix(".c.youtube.com");
505 crypto_config_.AddCanonicalSuffix(".googlevideo.com"); 508 crypto_config_.AddCanonicalSuffix(".googlevideo.com");
506 crypto_config_.SetProofVerifier( 509 crypto_config_.SetProofVerifier(
507 new ProofVerifierChromium(cert_verifier, transport_security_state)); 510 new ProofVerifierChromium(cert_verifier, transport_security_state));
508 crypto_config_.SetChannelIDSource( 511 crypto_config_.SetChannelIDSource(
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 active_sessions_[server_id] = session; 595 active_sessions_[server_id] = session;
593 session_aliases_[session].insert(server_id); 596 session_aliases_[session].insert(server_id);
594 return true; 597 return true;
595 } 598 }
596 } 599 }
597 return false; 600 return false;
598 } 601 }
599 602
600 void QuicStreamFactory::OnJobComplete(Job* job, int rv) { 603 void QuicStreamFactory::OnJobComplete(Job* job, int rv) {
601 if (rv == OK) { 604 if (rv == OK) {
602 require_confirmation_ = false; 605 require_confirmation_ = false;
Ryan Hamilton 2014/09/02 19:28:22 You could consider changing this to be: if (!al
Jana 2014/09/02 20:58:15 Thanks for the suggestion -- I've made changes tha
603 606
604 // Create all the streams, but do not notify them yet. 607 // Create all the streams, but do not notify them yet.
605 for (RequestSet::iterator it = job_requests_map_[job].begin(); 608 for (RequestSet::iterator it = job_requests_map_[job].begin();
606 it != job_requests_map_[job].end() ; ++it) { 609 it != job_requests_map_[job].end() ; ++it) {
607 DCHECK(HasActiveSession(job->server_id())); 610 DCHECK(HasActiveSession(job->server_id()));
608 (*it)->set_stream(CreateIfSessionExists(job->server_id(), 611 (*it)->set_stream(CreateIfSessionExists(job->server_id(),
609 (*it)->net_log())); 612 (*it)->net_log()));
610 } 613 }
611 } 614 }
612 while (!job_requests_map_[job].empty()) { 615 while (!job_requests_map_[job].empty()) {
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
976 http_server_properties_->ClearAlternateProtocol(server); 979 http_server_properties_->ClearAlternateProtocol(server);
977 http_server_properties_->SetAlternateProtocol( 980 http_server_properties_->SetAlternateProtocol(
978 server, alternate.port, alternate.protocol, 1); 981 server, alternate.port, alternate.protocol, 1);
979 DCHECK_EQ(QUIC, 982 DCHECK_EQ(QUIC,
980 http_server_properties_->GetAlternateProtocol(server).protocol); 983 http_server_properties_->GetAlternateProtocol(server).protocol);
981 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken( 984 DCHECK(http_server_properties_->WasAlternateProtocolRecentlyBroken(
982 server)); 985 server));
983 } 986 }
984 987
985 } // namespace net 988 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698