summaryrefslogtreecommitdiffstats
path: root/net/quic/port_suggester.h
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 19:05:41 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-10 19:05:41 +0000
commite1bc9c11561c3c0655f0be424023a3d63e2c1281 (patch)
tree3eb8a8e76ceec29343364bc709e6c4ae5641007d /net/quic/port_suggester.h
parent1ca31e413ae1b24bef8220a9c6cfd7efe48eebc9 (diff)
downloadchromium_src-e1bc9c11561c3c0655f0be424023a3d63e2c1281.zip
chromium_src-e1bc9c11561c3c0655f0be424023a3d63e2c1281.tar.gz
chromium_src-e1bc9c11561c3c0655f0be424023a3d63e2c1281.tar.bz2
Revert 239426 "Create and use a seeded random number generator"
It was tickling a top-crasher. > Create and use a seeded random number generator > (PortSuggester) to suggest what ephemeral source port > should be used when opening a UDP client socket in QUIC. > > This should increase the likelihood of 0-RTT connections, even if a strike server is not used across a server cluster. > > BUG=326545 > > Review URL: https://codereview.chromium.org/107803002 BUG=327057 TBR=jar@chromium.org Review URL: https://codereview.chromium.org/102093003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/quic/port_suggester.h')
-rw-r--r--net/quic/port_suggester.h50
1 files changed, 0 insertions, 50 deletions
diff --git a/net/quic/port_suggester.h b/net/quic/port_suggester.h
deleted file mode 100644
index 0074f7c..0000000
--- a/net/quic/port_suggester.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef NET_QUIC_PORT_SUGGESTER_H_
-#define NET_QUIC_PORT_SUGGESTER_H_
-
-#include "base/basictypes.h"
-#include "base/memory/ref_counted.h"
-#include "base/sha1.h"
-#include "net/base/net_export.h"
-
-namespace net {
-
-class HostPortPair;
-
-// We provide a pseudo-random number generator that is always seeded the same
-// way for a given destination host-port pair. The generator is used to
-// consistently suggest (for that host-port pair) an ephemeral source port,
-// and hence increase the likelihood that a server's load balancer will direct
-// a repeated connection to the same server (with QUIC, further increasing the
-// chance of connection establishment with 0-RTT).
-class NET_EXPORT_PRIVATE PortSuggester
- : public base::RefCounted<PortSuggester> {
- public:
- PortSuggester(const HostPortPair& server, uint64 seed);
-
- // Generate a pseudo-random int in the inclusive range from |min| to |max|.
- // Will (probably) return different numbers when called repeatedly.
- int SuggestPort(int min, int max);
-
- uint32 call_count() const { return call_count_; }
- int previous_suggestion() const;
-
- private:
- friend class base::RefCounted<PortSuggester>;
-
- virtual ~PortSuggester() {}
-
- // We maintain the first 8 bytes of a hash as our seed_ state.
- uint64 seed_;
- uint32 call_count_; // Number of suggestions made.
- int previous_suggestion_;
-
- DISALLOW_COPY_AND_ASSIGN(PortSuggester);
-};
-
-} // namespace net
-
-#endif // NET_QUIC_PORT_SUGGESTER_H_