| 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 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 return ContainsKey(active_sessions_, host_port_proxy_pair); | 527 return ContainsKey(active_sessions_, host_port_proxy_pair); |
| 528 } | 528 } |
| 529 | 529 |
| 530 int QuicStreamFactory::CreateSession( | 530 int QuicStreamFactory::CreateSession( |
| 531 const HostPortProxyPair& host_port_proxy_pair, | 531 const HostPortProxyPair& host_port_proxy_pair, |
| 532 bool is_https, | 532 bool is_https, |
| 533 CertVerifier* cert_verifier, | 533 CertVerifier* cert_verifier, |
| 534 const AddressList& address_list, | 534 const AddressList& address_list, |
| 535 const BoundNetLog& net_log, | 535 const BoundNetLog& net_log, |
| 536 QuicClientSession** session) { | 536 QuicClientSession** session) { |
| 537 QuicGuid guid = random_generator_->RandUint64(); | 537 QuicConnectionId connection_id = random_generator_->RandUint64(); |
| 538 IPEndPoint addr = *address_list.begin(); | 538 IPEndPoint addr = *address_list.begin(); |
| 539 scoped_refptr<PortSuggester> port_suggester = | 539 scoped_refptr<PortSuggester> port_suggester = |
| 540 new PortSuggester(host_port_proxy_pair.first, port_seed_); | 540 new PortSuggester(host_port_proxy_pair.first, port_seed_); |
| 541 DatagramSocket::BindType bind_type = enable_port_selection_ ? | 541 DatagramSocket::BindType bind_type = enable_port_selection_ ? |
| 542 DatagramSocket::RANDOM_BIND : // Use our callback. | 542 DatagramSocket::RANDOM_BIND : // Use our callback. |
| 543 DatagramSocket::DEFAULT_BIND; // Use OS to randomize. | 543 DatagramSocket::DEFAULT_BIND; // Use OS to randomize. |
| 544 scoped_ptr<DatagramClientSocket> socket( | 544 scoped_ptr<DatagramClientSocket> socket( |
| 545 client_socket_factory_->CreateDatagramClientSocket( | 545 client_socket_factory_->CreateDatagramClientSocket( |
| 546 bind_type, | 546 bind_type, |
| 547 base::Bind(&PortSuggester::SuggestPort, port_suggester), | 547 base::Bind(&PortSuggester::SuggestPort, port_suggester), |
| (...skipping 22 matching lines...) Expand all Loading... |
| 570 | 570 |
| 571 scoped_ptr<QuicDefaultPacketWriter> writer( | 571 scoped_ptr<QuicDefaultPacketWriter> writer( |
| 572 new QuicDefaultPacketWriter(socket.get())); | 572 new QuicDefaultPacketWriter(socket.get())); |
| 573 | 573 |
| 574 if (!helper_.get()) { | 574 if (!helper_.get()) { |
| 575 helper_.reset(new QuicConnectionHelper( | 575 helper_.reset(new QuicConnectionHelper( |
| 576 base::MessageLoop::current()->message_loop_proxy().get(), | 576 base::MessageLoop::current()->message_loop_proxy().get(), |
| 577 clock_.get(), random_generator_)); | 577 clock_.get(), random_generator_)); |
| 578 } | 578 } |
| 579 | 579 |
| 580 QuicConnection* connection = new QuicConnection(guid, addr, helper_.get(), | 580 QuicConnection* connection = new QuicConnection(connection_id, addr, |
| 581 helper_.get(), |
| 581 writer.get(), false, | 582 writer.get(), false, |
| 582 supported_versions_); | 583 supported_versions_); |
| 583 writer->SetConnection(connection); | 584 writer->SetConnection(connection); |
| 584 connection->options()->max_packet_length = max_packet_length_; | 585 connection->options()->max_packet_length = max_packet_length_; |
| 585 | 586 |
| 586 QuicCryptoClientConfig* crypto_config = | 587 QuicCryptoClientConfig* crypto_config = |
| 587 GetOrCreateCryptoConfig(host_port_proxy_pair); | 588 GetOrCreateCryptoConfig(host_port_proxy_pair); |
| 588 DCHECK(crypto_config); | 589 DCHECK(crypto_config); |
| 589 | 590 |
| 590 QuicConfig config = config_; | 591 QuicConfig config = config_; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 // Copy the CachedState for the canonical server from canonical_crypto_config | 684 // Copy the CachedState for the canonical server from canonical_crypto_config |
| 684 // as the initial CachedState for the server_hostname in crypto_config. | 685 // as the initial CachedState for the server_hostname in crypto_config. |
| 685 crypto_config->InitializeFrom(server_hostname, | 686 crypto_config->InitializeFrom(server_hostname, |
| 686 canonical_host_port_proxy_pair.first.host(), | 687 canonical_host_port_proxy_pair.first.host(), |
| 687 canonical_crypto_config); | 688 canonical_crypto_config); |
| 688 // Update canonical version to point at the "most recent" crypto_config. | 689 // Update canonical version to point at the "most recent" crypto_config. |
| 689 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair; | 690 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair; |
| 690 } | 691 } |
| 691 | 692 |
| 692 } // namespace net | 693 } // namespace net |
| OLD | NEW |