wgengine: remove unnecessary magicConnStarted channel.
Having removed magicconn.Start, there's no need to synchronize startup of other things to it any more. Signed-off-by: David Anderson <danderson@tailscale.com>pull/2776/head
parent
bb10443edf
commit
f90ac11bd8
|
@ -84,7 +84,6 @@ type userspaceEngine struct {
|
||||||
wgLogger *wglog.Logger //a wireguard-go logging wrapper
|
wgLogger *wglog.Logger //a wireguard-go logging wrapper
|
||||||
reqCh chan struct{}
|
reqCh chan struct{}
|
||||||
waitCh chan struct{} // chan is closed when first Close call completes; contrast with closing bool
|
waitCh chan struct{} // chan is closed when first Close call completes; contrast with closing bool
|
||||||
magicConnStarted chan struct{} // chan is closed after magicConn.Start
|
|
||||||
timeNow func() mono.Time
|
timeNow func() mono.Time
|
||||||
tundev *tstun.Wrapper
|
tundev *tstun.Wrapper
|
||||||
wgdev *device.Device
|
wgdev *device.Device
|
||||||
|
@ -271,7 +270,6 @@ func NewUserspaceEngine(logf logger.Logf, conf Config) (_ Engine, reterr error)
|
||||||
tundev: tsTUNDev,
|
tundev: tsTUNDev,
|
||||||
router: conf.Router,
|
router: conf.Router,
|
||||||
confListenPort: conf.ListenPort,
|
confListenPort: conf.ListenPort,
|
||||||
magicConnStarted: make(chan struct{}),
|
|
||||||
birdClient: conf.BIRDClient,
|
birdClient: conf.BIRDClient,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,8 +400,6 @@ func NewUserspaceEngine(logf logger.Logf, conf Config) (_ Engine, reterr error)
|
||||||
}
|
}
|
||||||
e.logf("Starting link monitor...")
|
e.logf("Starting link monitor...")
|
||||||
e.linkMon.Start()
|
e.linkMon.Start()
|
||||||
e.logf("Starting magicsock...")
|
|
||||||
close(e.magicConnStarted)
|
|
||||||
|
|
||||||
go e.pollResolver()
|
go e.pollResolver()
|
||||||
|
|
||||||
|
@ -1150,10 +1146,6 @@ func (e *userspaceEngine) LinkChange(_ bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *userspaceEngine) linkChange(changed bool, cur *interfaces.State) {
|
func (e *userspaceEngine) linkChange(changed bool, cur *interfaces.State) {
|
||||||
// Issue 2733: wait for e.magicConn to be started; there's two tiny
|
|
||||||
// windows at startup where this callback can be run before Start
|
|
||||||
<-e.magicConnStarted
|
|
||||||
|
|
||||||
up := cur.AnyInterfaceUp()
|
up := cur.AnyInterfaceUp()
|
||||||
if !up {
|
if !up {
|
||||||
e.logf("LinkChange: all links down; pausing: %v", cur)
|
e.logf("LinkChange: all links down; pausing: %v", cur)
|
||||||
|
|
Loading…
Reference in New Issue