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/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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 return OK; | 320 return OK; |
321 } | 321 } |
322 | 322 |
323 if (HasActiveJob(host_port_proxy_pair)) { | 323 if (HasActiveJob(host_port_proxy_pair)) { |
324 Job* job = active_jobs_[host_port_proxy_pair]; | 324 Job* job = active_jobs_[host_port_proxy_pair]; |
325 active_requests_[request] = job; | 325 active_requests_[request] = job; |
326 job_requests_map_[job].insert(request); | 326 job_requests_map_[job].insert(request); |
327 return ERR_IO_PENDING; | 327 return ERR_IO_PENDING; |
328 } | 328 } |
329 | 329 |
330 QuicCryptoClientConfig* crypto_config = | |
331 GetOrCreateCryptoConfig(host_port_proxy_pair); | |
332 DCHECK(crypto_config); | |
wtc
2014/02/04 01:37:02
Please add a comment to explain why we are doing t
ramant (doing other things)
2014/02/04 19:23:53
Added a comment about why we are starting this pro
| |
333 | |
330 scoped_ptr<Job> job(new Job(this, host_resolver_, host_port_proxy_pair, | 334 scoped_ptr<Job> job(new Job(this, host_resolver_, host_port_proxy_pair, |
331 is_https, cert_verifier, net_log)); | 335 is_https, cert_verifier, net_log)); |
332 int rv = job->Run(base::Bind(&QuicStreamFactory::OnJobComplete, | 336 int rv = job->Run(base::Bind(&QuicStreamFactory::OnJobComplete, |
333 base::Unretained(this), job.get())); | 337 base::Unretained(this), job.get())); |
334 | 338 |
335 if (rv == ERR_IO_PENDING) { | 339 if (rv == ERR_IO_PENDING) { |
336 active_requests_[request] = job.get(); | 340 active_requests_[request] = job.get(); |
337 job_requests_map_[job.get()].insert(request); | 341 job_requests_map_[job.get()].insert(request); |
338 active_jobs_[host_port_proxy_pair] = job.release(); | 342 active_jobs_[host_port_proxy_pair] = job.release(); |
339 } | 343 } |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
557 base::MessageLoop::current()->message_loop_proxy().get(), | 561 base::MessageLoop::current()->message_loop_proxy().get(), |
558 clock_.get(), random_generator_)); | 562 clock_.get(), random_generator_)); |
559 } | 563 } |
560 | 564 |
561 QuicConnection* connection = new QuicConnection(guid, addr, helper_.get(), | 565 QuicConnection* connection = new QuicConnection(guid, addr, helper_.get(), |
562 writer.get(), false, | 566 writer.get(), false, |
563 supported_versions_); | 567 supported_versions_); |
564 writer->SetConnection(connection); | 568 writer->SetConnection(connection); |
565 connection->options()->max_packet_length = max_packet_length_; | 569 connection->options()->max_packet_length = max_packet_length_; |
566 | 570 |
571 DCHECK(ContainsKey(all_crypto_configs_, host_port_proxy_pair)); | |
567 QuicCryptoClientConfig* crypto_config = | 572 QuicCryptoClientConfig* crypto_config = |
568 GetOrCreateCryptoConfig(host_port_proxy_pair); | 573 all_crypto_configs_[host_port_proxy_pair]; |
ramant (doing other things)
2014/02/04 19:23:53
Undid this change. GetOrCreateCryptoConfig is call
| |
569 DCHECK(crypto_config); | 574 DCHECK(crypto_config); |
570 | 575 |
571 *session = new QuicClientSession( | 576 *session = new QuicClientSession( |
572 connection, socket.Pass(), writer.Pass(), this, | 577 connection, socket.Pass(), writer.Pass(), this, |
573 quic_crypto_client_stream_factory_, host_port_proxy_pair.first.host(), | 578 quic_crypto_client_stream_factory_, host_port_proxy_pair.first.host(), |
574 config_, crypto_config, net_log.net_log()); | 579 config_, crypto_config, net_log.net_log()); |
575 all_sessions_.insert(*session); // owning pointer | 580 all_sessions_.insert(*session); // owning pointer |
576 if (is_https) { | 581 if (is_https) { |
577 crypto_config->SetProofVerifier( | 582 crypto_config->SetProofVerifier( |
578 new ProofVerifierChromium(cert_verifier, net_log)); | 583 new ProofVerifierChromium(cert_verifier, net_log)); |
(...skipping 20 matching lines...) Expand all Loading... | |
599 QuicCryptoClientConfig* QuicStreamFactory::GetOrCreateCryptoConfig( | 604 QuicCryptoClientConfig* QuicStreamFactory::GetOrCreateCryptoConfig( |
600 const HostPortProxyPair& host_port_proxy_pair) { | 605 const HostPortProxyPair& host_port_proxy_pair) { |
601 QuicCryptoClientConfig* crypto_config; | 606 QuicCryptoClientConfig* crypto_config; |
602 | 607 |
603 if (ContainsKey(all_crypto_configs_, host_port_proxy_pair)) { | 608 if (ContainsKey(all_crypto_configs_, host_port_proxy_pair)) { |
604 crypto_config = all_crypto_configs_[host_port_proxy_pair]; | 609 crypto_config = all_crypto_configs_[host_port_proxy_pair]; |
605 DCHECK(crypto_config); | 610 DCHECK(crypto_config); |
606 } else { | 611 } else { |
607 // TODO(rtenneti): if two quic_sessions for the same host_port_proxy_pair | 612 // TODO(rtenneti): if two quic_sessions for the same host_port_proxy_pair |
608 // share the same crypto_config, will it cause issues? | 613 // share the same crypto_config, will it cause issues? |
609 crypto_config = new QuicCryptoClientConfig(quic_server_info_factory_); | 614 crypto_config = new QuicCryptoClientConfig(); |
615 if (quic_server_info_factory_) { | |
616 QuicCryptoClientConfig::CachedState* cached = | |
617 crypto_config->CreateCachedState(host_port_proxy_pair.first.host(), | |
618 quic_server_info_factory_); | |
619 DCHECK(cached); | |
620 } | |
610 crypto_config->SetDefaults(); | 621 crypto_config->SetDefaults(); |
611 all_crypto_configs_[host_port_proxy_pair] = crypto_config; | 622 all_crypto_configs_[host_port_proxy_pair] = crypto_config; |
612 PopulateFromCanonicalConfig(host_port_proxy_pair, crypto_config); | 623 PopulateFromCanonicalConfig(host_port_proxy_pair, crypto_config); |
613 } | 624 } |
614 return crypto_config; | 625 return crypto_config; |
615 } | 626 } |
616 | 627 |
617 void QuicStreamFactory::PopulateFromCanonicalConfig( | 628 void QuicStreamFactory::PopulateFromCanonicalConfig( |
618 const HostPortProxyPair& host_port_proxy_pair, | 629 const HostPortProxyPair& host_port_proxy_pair, |
619 QuicCryptoClientConfig* crypto_config) { | 630 QuicCryptoClientConfig* crypto_config) { |
(...skipping 27 matching lines...) Expand all Loading... | |
647 // Copy the CachedState for the canonical server from canonical_crypto_config | 658 // Copy the CachedState for the canonical server from canonical_crypto_config |
648 // as the initial CachedState for the server_hostname in crypto_config. | 659 // as the initial CachedState for the server_hostname in crypto_config. |
649 crypto_config->InitializeFrom(server_hostname, | 660 crypto_config->InitializeFrom(server_hostname, |
650 canonical_host_port_proxy_pair.first.host(), | 661 canonical_host_port_proxy_pair.first.host(), |
651 canonical_crypto_config); | 662 canonical_crypto_config); |
652 // Update canonical version to point at the "most recent" crypto_config. | 663 // Update canonical version to point at the "most recent" crypto_config. |
653 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair; | 664 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair; |
654 } | 665 } |
655 | 666 |
656 } // namespace net | 667 } // namespace net |
OLD | NEW |