mirror of
https://github.com/tailscale/tailscale.git
synced 2025-05-03 14:11:02 +00:00
ipn/ipnlocal: initialize Taildrive shares when starting backend
Previously, it initialized when the backend was created. This caused two problems: 1. It would not properly switch when changing profiles. 2. If the backend was created before the profile had been selected, Taildrive's shares were uninitialized. Updates #14825 Signed-off-by: Percy Wegmann <percy@tailscale.com>
This commit is contained in:
parent
a567f56445
commit
ce6ce81311
@ -618,19 +618,6 @@ func NewLocalBackend(logf logger.Logf, logID logid.PublicID, sys *tsd.System, lo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize Taildrive shares from saved state
|
|
||||||
fs, ok := b.sys.DriveForRemote.GetOK()
|
|
||||||
if ok {
|
|
||||||
currentShares := b.pm.prefs.DriveShares()
|
|
||||||
if currentShares.Len() > 0 {
|
|
||||||
var shares []*drive.Share
|
|
||||||
for _, share := range currentShares.All() {
|
|
||||||
shares = append(shares, share.AsStruct())
|
|
||||||
}
|
|
||||||
fs.SetShares(shares)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for name, newFn := range registeredExtensions {
|
for name, newFn := range registeredExtensions {
|
||||||
ext, err := newFn(logf, sys)
|
ext, err := newFn(logf, sys)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -2458,6 +2445,16 @@ func (b *LocalBackend) Start(opts ipn.Options) error {
|
|||||||
b.logf("Backend: logs: be:%v fe:%v", blid, opts.FrontendLogID)
|
b.logf("Backend: logs: be:%v fe:%v", blid, opts.FrontendLogID)
|
||||||
b.sendToLocked(ipn.Notify{Prefs: &prefs}, allClients)
|
b.sendToLocked(ipn.Notify{Prefs: &prefs}, allClients)
|
||||||
|
|
||||||
|
// initialize Taildrive shares from saved state
|
||||||
|
if fs, ok := b.sys.DriveForRemote.GetOK(); ok {
|
||||||
|
currentShares := b.pm.CurrentPrefs().DriveShares()
|
||||||
|
var shares []*drive.Share
|
||||||
|
for _, share := range currentShares.All() {
|
||||||
|
shares = append(shares, share.AsStruct())
|
||||||
|
}
|
||||||
|
fs.SetShares(shares)
|
||||||
|
}
|
||||||
|
|
||||||
if !loggedOut && (b.hasNodeKeyLocked() || confWantRunning) {
|
if !loggedOut && (b.hasNodeKeyLocked() || confWantRunning) {
|
||||||
// If we know that we're either logged in or meant to be
|
// If we know that we're either logged in or meant to be
|
||||||
// running, tell the controlclient that it should also assume
|
// running, tell the controlclient that it should also assume
|
||||||
|
Loading…
x
Reference in New Issue
Block a user