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

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

Issue 127463003: Completely disable use of bind() with pseudo-random port selection on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Let Windows tests ignore lack of use of bind() 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
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;
Ryan Hamilton 2014/01/08 22:21:52 nit: i wonder if it would more symmetrical to do:
518 #endif
514 scoped_ptr<DatagramClientSocket> socket( 519 scoped_ptr<DatagramClientSocket> socket(
515 client_socket_factory_->CreateDatagramClientSocket( 520 client_socket_factory_->CreateDatagramClientSocket(
516 DatagramSocket::RANDOM_BIND, 521 bind_type,
517 base::Bind(&PortSuggester::SuggestPort, port_suggester), 522 base::Bind(&PortSuggester::SuggestPort, port_suggester),
518 net_log.net_log(), net_log.source())); 523 net_log.net_log(), net_log.source()));
519 int rv = socket->Connect(addr); 524 int rv = socket->Connect(addr);
520 if (rv != OK) 525 if (rv != OK)
521 return rv; 526 return rv;
522 UMA_HISTOGRAM_COUNTS("Net.QuicEphemeralPortsSuggested", 527 UMA_HISTOGRAM_COUNTS("Net.QuicEphemeralPortsSuggested",
523 port_suggester->call_count()); 528 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
524 DCHECK_LE(1u, port_suggester->call_count()); 533 DCHECK_LE(1u, port_suggester->call_count());
534 #endif
wtc 2014/01/08 22:36:05 I would just do // TODO(jar)bug=329255 Provide be
525 535
526 // We should adaptively set this buffer size, but for now, we'll use a size 536 // We should adaptively set this buffer size, but for now, we'll use a size
527 // that is more than large enough for a full receive window, and yet 537 // that is more than large enough for a full receive window, and yet
528 // does not consume "too much" memory. If we see bursty packet loss, we may 538 // does not consume "too much" memory. If we see bursty packet loss, we may
529 // revisit this setting and test for its impact. 539 // revisit this setting and test for its impact.
530 const int32 kSocketBufferSize(TcpReceiver::kReceiveWindowTCP); 540 const int32 kSocketBufferSize(TcpReceiver::kReceiveWindowTCP);
531 socket->SetReceiveBufferSize(kSocketBufferSize); 541 socket->SetReceiveBufferSize(kSocketBufferSize);
532 // Set a buffer large enough to contain the initial CWND's worth of packet 542 // Set a buffer large enough to contain the initial CWND's worth of packet
533 // to work around the problem with CHLO packets being sent out with the 543 // to work around the problem with CHLO packets being sent out with the
534 // wrong encryption level, when the send buffer is full. 544 // wrong encryption level, when the send buffer is full.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 // Copy the CachedState for the canonical server from canonical_crypto_config 642 // Copy the CachedState for the canonical server from canonical_crypto_config
633 // as the initial CachedState for the server_hostname in crypto_config. 643 // as the initial CachedState for the server_hostname in crypto_config.
634 crypto_config->InitializeFrom(server_hostname, 644 crypto_config->InitializeFrom(server_hostname,
635 canonical_host_port_proxy_pair.first.host(), 645 canonical_host_port_proxy_pair.first.host(),
636 canonical_crypto_config); 646 canonical_crypto_config);
637 // Update canonical version to point at the "most recent" crypto_config. 647 // Update canonical version to point at the "most recent" crypto_config.
638 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair; 648 canonical_hostname_to_origin_map_[canonical_host_port] = host_port_proxy_pair;
639 } 649 }
640 650
641 } // namespace net 651 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/quic/quic_stream_factory_test.cc » ('j') | net/quic/quic_stream_factory_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698