mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-03 06:45:49 +00:00
ipn/ipnlocal: call SetNetInfoCallback from NewLocalBackend
Instead of calling it from Start everytime, call it from NewLocalBackend once. Updates #11649 Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
parent
85b9a6c601
commit
e1011f1387
@ -368,7 +368,7 @@ func NewLocalBackend(logf logger.Logf, logID logid.PublicID, sys *tsd.System, lo
|
|||||||
if dialer.NetMon() == nil {
|
if dialer.NetMon() == nil {
|
||||||
return nil, errors.New("dialer to NewLocalBackend must have a NetMon")
|
return nil, errors.New("dialer to NewLocalBackend must have a NetMon")
|
||||||
}
|
}
|
||||||
_ = sys.MagicSock.Get() // or panic
|
mConn := sys.MagicSock.Get()
|
||||||
|
|
||||||
goos := envknob.GOOS()
|
goos := envknob.GOOS()
|
||||||
if loginFlags&controlclient.LocalBackendStartKeyOSNeutral != 0 {
|
if loginFlags&controlclient.LocalBackendStartKeyOSNeutral != 0 {
|
||||||
@ -428,6 +428,7 @@ func NewLocalBackend(logf logger.Logf, logID logid.PublicID, sys *tsd.System, lo
|
|||||||
selfUpdateProgress: make([]ipnstate.UpdateProgress, 0),
|
selfUpdateProgress: make([]ipnstate.UpdateProgress, 0),
|
||||||
lastSelfUpdateState: ipnstate.UpdateFinished,
|
lastSelfUpdateState: ipnstate.UpdateFinished,
|
||||||
}
|
}
|
||||||
|
mConn.SetNetInfoCallback(b.setNetInfo)
|
||||||
|
|
||||||
netMon := sys.NetMon.Get()
|
netMon := sys.NetMon.Get()
|
||||||
b.sockstatLogger, err = sockstatlog.NewLogger(logpolicy.LogsDir(logf), logf, logID, netMon, sys.HealthTracker())
|
b.sockstatLogger, err = sockstatlog.NewLogger(logpolicy.LogsDir(logf), logf, logID, netMon, sys.HealthTracker())
|
||||||
@ -1816,8 +1817,6 @@ func (b *LocalBackend) Start(opts ipn.Options) error {
|
|||||||
}
|
}
|
||||||
cc.SetTKAHead(tkaHead)
|
cc.SetTKAHead(tkaHead)
|
||||||
|
|
||||||
b.MagicConn().SetNetInfoCallback(b.setNetInfo)
|
|
||||||
|
|
||||||
blid := b.backendLogID.String()
|
blid := b.backendLogID.String()
|
||||||
b.logf("Backend: logs: be:%v fe:%v", blid, opts.FrontendLogID)
|
b.logf("Backend: logs: be:%v fe:%v", blid, opts.FrontendLogID)
|
||||||
b.send(ipn.Notify{BackendLogID: &blid})
|
b.send(ipn.Notify{BackendLogID: &blid})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user