mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-22 22:58:25 +00:00
lib/model: Cleanup conditions
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4621
This commit is contained in:
parent
c24bf7ea55
commit
9988044bbe
@ -111,3 +111,4 @@ All code is licensed under the [MPLv2 License][7].
|
|||||||
[13]: https://github.com/syncthing/syncthing/blob/master/GOALS.md
|
[13]: https://github.com/syncthing/syncthing/blob/master/GOALS.md
|
||||||
[14]: assets/logo-text-128.png
|
[14]: assets/logo-text-128.png
|
||||||
[15]: https://syncthing.net/
|
[15]: https://syncthing.net/
|
||||||
|
|
||||||
|
@ -382,12 +382,12 @@ func (m *Model) RestartFolder(cfg config.FolderConfiguration) {
|
|||||||
m.pmut.Lock()
|
m.pmut.Lock()
|
||||||
|
|
||||||
m.tearDownFolderLocked(cfg.ID)
|
m.tearDownFolderLocked(cfg.ID)
|
||||||
if !cfg.Paused {
|
if cfg.Paused {
|
||||||
|
l.Infoln("Paused folder", cfg.Description())
|
||||||
|
} else {
|
||||||
m.addFolderLocked(cfg)
|
m.addFolderLocked(cfg)
|
||||||
folderType := m.startFolderLocked(cfg.ID)
|
folderType := m.startFolderLocked(cfg.ID)
|
||||||
l.Infoln("Restarted folder", cfg.Description(), fmt.Sprintf("(%s)", folderType))
|
l.Infoln("Restarted folder", cfg.Description(), fmt.Sprintf("(%s)", folderType))
|
||||||
} else {
|
|
||||||
l.Infoln("Paused folder", cfg.Description())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m.pmut.Unlock()
|
m.pmut.Unlock()
|
||||||
@ -1222,17 +1222,17 @@ func (m *Model) handleAutoAccepts(deviceCfg config.DeviceConfiguration, folder p
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Folder already exists.
|
// Folder does not exist yet.
|
||||||
if !m.folderSharedWith(folder.ID, deviceCfg.DeviceID) {
|
if m.folderSharedWith(folder.ID, deviceCfg.DeviceID) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
m.fmut.Lock()
|
m.fmut.Lock()
|
||||||
w := m.shareFolderWithDeviceLocked(deviceCfg.DeviceID, folder.ID, protocol.DeviceID{})
|
w := m.shareFolderWithDeviceLocked(deviceCfg.DeviceID, folder.ID, protocol.DeviceID{})
|
||||||
m.fmut.Unlock()
|
m.fmut.Unlock()
|
||||||
w.Wait()
|
w.Wait()
|
||||||
l.Infof("Shared %s with %s due to auto-accept", folder.ID, deviceCfg.DeviceID)
|
l.Infof("Shared %s with %s due to auto-accept", folder.ID, deviceCfg.DeviceID)
|
||||||
return true
|
return true
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Model) introduceDevice(device protocol.Device, introducerCfg config.DeviceConfiguration) {
|
func (m *Model) introduceDevice(device protocol.Device, introducerCfg config.DeviceConfiguration) {
|
||||||
@ -2560,7 +2560,6 @@ func (m *Model) checkDeviceFolderConnectedLocked(device protocol.DeviceID, folde
|
|||||||
if !m.folderDevices.has(device, folder) {
|
if !m.folderDevices.has(device, folder) {
|
||||||
return errors.New("folder is not shared with device")
|
return errors.New("folder is not shared with device")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user