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/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 const HostPortProxyPair& host_port_proxy_pair, | 365 const HostPortProxyPair& host_port_proxy_pair, |
366 const AddressList& address_list, | 366 const AddressList& address_list, |
367 const BoundNetLog& net_log) { | 367 const BoundNetLog& net_log) { |
368 QuicGuid guid = random_generator_->RandUint64(); | 368 QuicGuid guid = random_generator_->RandUint64(); |
369 IPEndPoint addr = *address_list.begin(); | 369 IPEndPoint addr = *address_list.begin(); |
370 DatagramClientSocket* socket = | 370 DatagramClientSocket* socket = |
371 client_socket_factory_->CreateDatagramClientSocket( | 371 client_socket_factory_->CreateDatagramClientSocket( |
372 DatagramSocket::DEFAULT_BIND, base::Bind(&base::RandInt), | 372 DatagramSocket::DEFAULT_BIND, base::Bind(&base::RandInt), |
373 net_log.net_log(), net_log.source()); | 373 net_log.net_log(), net_log.source()); |
374 socket->Connect(addr); | 374 socket->Connect(addr); |
375 socket->GetLocalAddress(&addr); | |
376 | 375 |
377 QuicConnectionHelper* helper = new QuicConnectionHelper( | 376 QuicConnectionHelper* helper = new QuicConnectionHelper( |
378 MessageLoop::current()->message_loop_proxy(), | 377 MessageLoop::current()->message_loop_proxy(), |
379 clock_.get(), random_generator_, socket); | 378 clock_.get(), random_generator_, socket); |
380 | 379 |
381 QuicConnection* connection = new QuicConnection(guid, addr, helper, false); | 380 QuicConnection* connection = new QuicConnection(guid, addr, helper, false); |
382 | 381 |
383 QuicCryptoClientConfig* crypto_config = | 382 QuicCryptoClientConfig* crypto_config = |
384 GetOrCreateCryptoConfig(host_port_proxy_pair); | 383 GetOrCreateCryptoConfig(host_port_proxy_pair); |
385 DCHECK(crypto_config); | 384 DCHECK(crypto_config); |
386 | 385 |
387 QuicClientSession* session = | 386 QuicClientSession* session = |
388 new QuicClientSession(connection, socket, this, | 387 new QuicClientSession(connection, socket, this, |
389 quic_crypto_client_stream_factory_, | 388 quic_crypto_client_stream_factory_, |
390 host_port_proxy_pair.first.host(), | 389 host_port_proxy_pair.first.host(), QuicConfig(), |
391 crypto_config, net_log.net_log()); | 390 crypto_config, net_log.net_log()); |
392 all_sessions_.insert(session); // owning pointer | 391 all_sessions_.insert(session); // owning pointer |
393 return session; | 392 return session; |
394 } | 393 } |
395 | 394 |
396 bool QuicStreamFactory::HasActiveJob( | 395 bool QuicStreamFactory::HasActiveJob( |
397 const HostPortProxyPair& host_port_proxy_pair) { | 396 const HostPortProxyPair& host_port_proxy_pair) { |
398 return ContainsKey(active_jobs_, host_port_proxy_pair); | 397 return ContainsKey(active_jobs_, host_port_proxy_pair); |
399 } | 398 } |
400 | 399 |
(...skipping 13 matching lines...) Expand all Loading... |
414 DCHECK(crypto_config); | 413 DCHECK(crypto_config); |
415 } else { | 414 } else { |
416 crypto_config = new QuicCryptoClientConfig(); | 415 crypto_config = new QuicCryptoClientConfig(); |
417 crypto_config->SetDefaults(); | 416 crypto_config->SetDefaults(); |
418 all_crypto_configs_[host_port_proxy_pair] = crypto_config; | 417 all_crypto_configs_[host_port_proxy_pair] = crypto_config; |
419 } | 418 } |
420 return crypto_config; | 419 return crypto_config; |
421 } | 420 } |
422 | 421 |
423 } // namespace net | 422 } // namespace net |
OLD | NEW |