mirror of
https://github.com/tailscale/tailscale.git
synced 2025-10-04 20:12:16 +02:00
ipn/ipnlocal: fix eventbus data race
Fixes #17252 Change-Id: Id969fca750a48fb43431c53f3e0631bd9bd496d1 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
4af15a1148
commit
87ccfbd250
@ -535,8 +535,6 @@ func NewLocalBackend(logf logger.Logf, logID logid.PublicID, sys *tsd.System, lo
|
||||
captiveCancel: nil, // so that we start checkCaptivePortalLoop when Running
|
||||
needsCaptiveDetection: make(chan bool),
|
||||
}
|
||||
ec := b.Sys().Bus.Get().Client("ipnlocal.LocalBackend")
|
||||
b.eventSubs = ec.Monitor(b.consumeEventbusTopics(ec))
|
||||
|
||||
nb := newNodeBackend(ctx, b.sys.Bus.Get())
|
||||
b.currentNodeAtomic.Store(nb)
|
||||
@ -604,6 +602,12 @@ func NewLocalBackend(logf logger.Logf, logID logid.PublicID, sys *tsd.System, lo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Start the event bus late, once all the assignments above are done.
|
||||
// (See previous race in tailscale/tailscale#17252)
|
||||
ec := b.Sys().Bus.Get().Client("ipnlocal.LocalBackend")
|
||||
b.eventSubs = ec.Monitor(b.consumeEventbusTopics(ec))
|
||||
|
||||
return b, nil
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user