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 if (quic_server_info_factory_) { | |
331 // Start the async lookup of crypto config data from the disk cache. | |
332 quic_server_info_.reset(quic_server_info_factory_->GetForHost( | |
333 host_port_proxy_pair.first.host())); | |
334 quic_server_info_->Start(); | |
wtc
2014/01/30 20:14:26
It is wrong to set quic_server_info_ here, because
ramant (doing other things)
2014/02/02 19:35:10
Modified the code to create the crypto config and
| |
335 } | |
336 | |
330 scoped_ptr<Job> job(new Job(this, host_resolver_, host_port_proxy_pair, | 337 scoped_ptr<Job> job(new Job(this, host_resolver_, host_port_proxy_pair, |
331 is_https, cert_verifier, net_log)); | 338 is_https, cert_verifier, net_log)); |
332 int rv = job->Run(base::Bind(&QuicStreamFactory::OnJobComplete, | 339 int rv = job->Run(base::Bind(&QuicStreamFactory::OnJobComplete, |
333 base::Unretained(this), job.get())); | 340 base::Unretained(this), job.get())); |
334 | 341 |
335 if (rv == ERR_IO_PENDING) { | 342 if (rv == ERR_IO_PENDING) { |
336 active_requests_[request] = job.get(); | 343 active_requests_[request] = job.get(); |
337 job_requests_map_[job.get()].insert(request); | 344 job_requests_map_[job.get()].insert(request); |
338 active_jobs_[host_port_proxy_pair] = job.release(); | 345 active_jobs_[host_port_proxy_pair] = job.release(); |
339 } | 346 } |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
599 QuicCryptoClientConfig* QuicStreamFactory::GetOrCreateCryptoConfig( | 606 QuicCryptoClientConfig* QuicStreamFactory::GetOrCreateCryptoConfig( |
600 const HostPortProxyPair& host_port_proxy_pair) { | 607 const HostPortProxyPair& host_port_proxy_pair) { |
601 QuicCryptoClientConfig* crypto_config; | 608 QuicCryptoClientConfig* crypto_config; |
602 | 609 |
603 if (ContainsKey(all_crypto_configs_, host_port_proxy_pair)) { | 610 if (ContainsKey(all_crypto_configs_, host_port_proxy_pair)) { |
604 crypto_config = all_crypto_configs_[host_port_proxy_pair]; | 611 crypto_config = all_crypto_configs_[host_port_proxy_pair]; |
605 DCHECK(crypto_config); | 612 DCHECK(crypto_config); |
606 } else { | 613 } else { |
607 // TODO(rtenneti): if two quic_sessions for the same host_port_proxy_pair | 614 // TODO(rtenneti): if two quic_sessions for the same host_port_proxy_pair |
608 // share the same crypto_config, will it cause issues? | 615 // share the same crypto_config, will it cause issues? |
609 crypto_config = new QuicCryptoClientConfig(quic_server_info_factory_); | 616 crypto_config = new QuicCryptoClientConfig(quic_server_info_.Pass()); |
610 crypto_config->SetDefaults(); | 617 crypto_config->SetDefaults(); |
611 all_crypto_configs_[host_port_proxy_pair] = crypto_config; | 618 all_crypto_configs_[host_port_proxy_pair] = crypto_config; |
612 PopulateFromCanonicalConfig(host_port_proxy_pair, crypto_config); | 619 PopulateFromCanonicalConfig(host_port_proxy_pair, crypto_config); |
613 } | 620 } |
614 return crypto_config; | 621 return crypto_config; |
615 } | 622 } |
616 | 623 |
617 void QuicStreamFactory::PopulateFromCanonicalConfig( | 624 void QuicStreamFactory::PopulateFromCanonicalConfig( |
618 const HostPortProxyPair& host_port_proxy_pair, | 625 const HostPortProxyPair& host_port_proxy_pair, |
619 QuicCryptoClientConfig* crypto_config) { | 626 QuicCryptoClientConfig* crypto_config) { |
(...skipping 27 matching lines...) Expand all Loading... | |
647 // Copy the CachedState for the canonical server from canonical_crypto_config | 654 // Copy the CachedState for the canonical server from canonical_crypto_config |
648 // as the initial CachedState for the server_hostname in crypto_config. | 655 // as the initial CachedState for the server_hostname in crypto_config. |
649 crypto_config->InitializeFrom(server_hostname, | 656 crypto_config->InitializeFrom(server_hostname, |
650 canonical_host_port_proxy_pair.first.host(), | 657 canonical_host_port_proxy_pair.first.host(), |
651 canonical_crypto_config); | 658 canonical_crypto_config); |
652 // Update canonical version to point at the "most recent" crypto_config. | 659 // Update canonical version to point at the "most recent" crypto_config. |
653 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair; | 660 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair; |
654 } | 661 } |
655 | 662 |
656 } // namespace net | 663 } // namespace net |
OLD | NEW |