mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-16 19:51:41 +00:00
portlist: unexport GetList
It's an internal implementation detail, and I plan to refactor it for performance (garbage) reasons anyway, so start by hiding it. Updates #5958 Change-Id: I2c0d1f743d3495c5f798d1d8afc364692cd9d290 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
7b745a1a50
commit
67597bfc9e
@ -45,7 +45,7 @@ func NewPoller() (*Poller, error) {
|
|||||||
// Do one initial poll synchronously so we can return an error
|
// Do one initial poll synchronously so we can return an error
|
||||||
// early.
|
// early.
|
||||||
var err error
|
var err error
|
||||||
p.prev, err = GetList(nil)
|
p.prev, err = getList(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -76,7 +76,7 @@ func (p *Poller) Run(ctx context.Context) error {
|
|||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-tick.C:
|
case <-tick.C:
|
||||||
pl, err := GetList(p.prev)
|
pl, err := getList(p.prev)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.Err = err
|
p.Err = err
|
||||||
return err
|
return err
|
||||||
|
@ -76,7 +76,7 @@ func (pl List) String() string {
|
|||||||
|
|
||||||
var debugDisablePortlist = envknob.RegisterBool("TS_DEBUG_DISABLE_PORTLIST")
|
var debugDisablePortlist = envknob.RegisterBool("TS_DEBUG_DISABLE_PORTLIST")
|
||||||
|
|
||||||
func GetList(prev List) (List, error) {
|
func getList(prev List) (List, error) {
|
||||||
if debugDisablePortlist() {
|
if debugDisablePortlist() {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
func TestGetList(t *testing.T) {
|
func TestGetList(t *testing.T) {
|
||||||
tstest.ResourceCheck(t)
|
tstest.ResourceCheck(t)
|
||||||
|
|
||||||
pl, err := GetList(nil)
|
pl, err := getList(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ func TestIgnoreLocallyBoundPorts(t *testing.T) {
|
|||||||
defer ln.Close()
|
defer ln.Close()
|
||||||
ta := ln.Addr().(*net.TCPAddr)
|
ta := ln.Addr().(*net.TCPAddr)
|
||||||
port := ta.Port
|
port := ta.Port
|
||||||
pl, err := GetList(nil)
|
pl, err := getList(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -195,7 +195,7 @@ func TestSameInodes(t *testing.T) {
|
|||||||
func BenchmarkGetList(b *testing.B) {
|
func BenchmarkGetList(b *testing.B) {
|
||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
_, err := GetList(nil)
|
_, err := getList(nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatal(err)
|
b.Fatal(err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user