summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMarwan Sulaiman <marwan@tailscale.com>2023-05-25 09:03:28 -0400
committerMarwan Sulaiman <marwan@tailscale.com>2023-05-25 09:03:28 -0400
commit821c589f98d62ccb32f38fbf822b73a8ab975905 (patch)
tree3ce38eb0b896a2f34f8d0c7b1b914cfc3d1b95cf
parent27ea0620789708ab1fde5aac6c2569638824b819 (diff)
downloadtailscale-marwan/noconstructor.tar.xz
tailscale-marwan/noconstructor.zip
portlist: move sync.Once up and Close on errmarwan/noconstructor
Signed-off-by: Marwan Sulaiman <marwan@tailscale.com>
-rw-r--r--ipn/ipnlocal/local.go1
-rw-r--r--portlist/poller.go3
2 files changed, 2 insertions, 2 deletions
diff --git a/ipn/ipnlocal/local.go b/ipn/ipnlocal/local.go
index 36ab52979..e64e2cb50 100644
--- a/ipn/ipnlocal/local.go
+++ b/ipn/ipnlocal/local.go
@@ -296,6 +296,7 @@ func NewLocalBackend(logf logger.Logf, logID logid.PublicID, sys *tsd.System, lo
err = portpoll.Check()
if err != nil {
logf("skipping portlist: %s", err)
+ portpoll.Close()
portpoll = nil
}
diff --git a/portlist/poller.go b/portlist/poller.go
index 6e39bb872..9798a5e41 100644
--- a/portlist/poller.go
+++ b/portlist/poller.go
@@ -29,9 +29,8 @@ type Poller struct {
// This field should only be changed before calling Run.
IncludeLocalhost bool
- c chan List // unbuffered
-
initOnce sync.Once // guards init of private fields
+ c chan List // unbuffered
// os, if non-nil, is an OS-specific implementation of the portlist getting
// code. When non-nil, it's responsible for getting the complete list of