portlist: move sync.Once up and Close on err
Signed-off-by: Marwan Sulaiman <marwan@tailscale.com>marwan/noconstructor
parent
27ea062078
commit
821c589f98
|
@ -296,6 +296,7 @@ func NewLocalBackend(logf logger.Logf, logID logid.PublicID, sys *tsd.System, lo
|
||||||
err = portpoll.Check()
|
err = portpoll.Check()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logf("skipping portlist: %s", err)
|
logf("skipping portlist: %s", err)
|
||||||
|
portpoll.Close()
|
||||||
portpoll = nil
|
portpoll = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,9 +29,8 @@ type Poller struct {
|
||||||
// This field should only be changed before calling Run.
|
// This field should only be changed before calling Run.
|
||||||
IncludeLocalhost bool
|
IncludeLocalhost bool
|
||||||
|
|
||||||
c chan List // unbuffered
|
|
||||||
|
|
||||||
initOnce sync.Once // guards init of private fields
|
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
|
// 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
|
// code. When non-nil, it's responsible for getting the complete list of
|
||||||
|
|
Loading…
Reference in New Issue