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

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

Issue 132603002: Revert of Completely disable use of bind() with pseudo-random port selection on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/quic/quic_stream_factory_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 const HostPortProxyPair& host_port_proxy_pair, 504 const HostPortProxyPair& host_port_proxy_pair,
505 bool is_https, 505 bool is_https,
506 CertVerifier* cert_verifier, 506 CertVerifier* cert_verifier,
507 const AddressList& address_list, 507 const AddressList& address_list,
508 const BoundNetLog& net_log, 508 const BoundNetLog& net_log,
509 QuicClientSession** session) { 509 QuicClientSession** session) {
510 QuicGuid guid = random_generator_->RandUint64(); 510 QuicGuid guid = random_generator_->RandUint64();
511 IPEndPoint addr = *address_list.begin(); 511 IPEndPoint addr = *address_list.begin();
512 scoped_refptr<PortSuggester> port_suggester = 512 scoped_refptr<PortSuggester> port_suggester =
513 new PortSuggester(host_port_proxy_pair.first, port_seed_); 513 new PortSuggester(host_port_proxy_pair.first, port_seed_);
514 DatagramSocket::BindType bind_type = DatagramSocket::RANDOM_BIND;
515 #if defined(OS_WIN)
516 // TODO(jar)bug=329255 Provide better implementation to avoid pop-up warning.
517 bind_type = DatagramSocket::DEFAULT_BIND;
518 #endif
519 scoped_ptr<DatagramClientSocket> socket( 514 scoped_ptr<DatagramClientSocket> socket(
520 client_socket_factory_->CreateDatagramClientSocket( 515 client_socket_factory_->CreateDatagramClientSocket(
521 bind_type, 516 DatagramSocket::RANDOM_BIND,
522 base::Bind(&PortSuggester::SuggestPort, port_suggester), 517 base::Bind(&PortSuggester::SuggestPort, port_suggester),
523 net_log.net_log(), net_log.source())); 518 net_log.net_log(), net_log.source()));
524 int rv = socket->Connect(addr); 519 int rv = socket->Connect(addr);
525 if (rv != OK) 520 if (rv != OK)
526 return rv; 521 return rv;
527 UMA_HISTOGRAM_COUNTS("Net.QuicEphemeralPortsSuggested", 522 UMA_HISTOGRAM_COUNTS("Net.QuicEphemeralPortsSuggested",
528 port_suggester->call_count()); 523 port_suggester->call_count());
529 #if defined(OS_WIN)
530 // TODO(jar)bug=329255 Provide better implementation to avoid pop-up warning.
531 DCHECK_EQ(0u, port_suggester->call_count());
532 #else
533 DCHECK_LE(1u, port_suggester->call_count()); 524 DCHECK_LE(1u, port_suggester->call_count());
534 #endif
535 525
536 // We should adaptively set this buffer size, but for now, we'll use a size 526 // We should adaptively set this buffer size, but for now, we'll use a size
537 // that is more than large enough for a full receive window, and yet 527 // that is more than large enough for a full receive window, and yet
538 // does not consume "too much" memory. If we see bursty packet loss, we may 528 // does not consume "too much" memory. If we see bursty packet loss, we may
539 // revisit this setting and test for its impact. 529 // revisit this setting and test for its impact.
540 const int32 kSocketBufferSize(TcpReceiver::kReceiveWindowTCP); 530 const int32 kSocketBufferSize(TcpReceiver::kReceiveWindowTCP);
541 socket->SetReceiveBufferSize(kSocketBufferSize); 531 socket->SetReceiveBufferSize(kSocketBufferSize);
542 // Set a buffer large enough to contain the initial CWND's worth of packet 532 // Set a buffer large enough to contain the initial CWND's worth of packet
543 // to work around the problem with CHLO packets being sent out with the 533 // to work around the problem with CHLO packets being sent out with the
544 // wrong encryption level, when the send buffer is full. 534 // wrong encryption level, when the send buffer is full.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 // Copy the CachedState for the canonical server from canonical_crypto_config 632 // Copy the CachedState for the canonical server from canonical_crypto_config
643 // as the initial CachedState for the server_hostname in crypto_config. 633 // as the initial CachedState for the server_hostname in crypto_config.
644 crypto_config->InitializeFrom(server_hostname, 634 crypto_config->InitializeFrom(server_hostname,
645 canonical_host_port_proxy_pair.first.host(), 635 canonical_host_port_proxy_pair.first.host(),
646 canonical_crypto_config); 636 canonical_crypto_config);
647 // Update canonical version to point at the "most recent" crypto_config. 637 // Update canonical version to point at the "most recent" crypto_config.
648 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair; 638 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair;
649 } 639 }
650 640
651 } // namespace net 641 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/quic_stream_factory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698