|
@@ -2562,30 +2562,6 @@ func (m *model) checkFolderRunningLocked(folder string) error {
|
|
|
return errFolderNotRunning
|
|
return errFolderNotRunning
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// checkFolderDeviceStatusLocked first checks the folder and then whether the
|
|
|
|
|
-// given device is connected and shares this folder.
|
|
|
|
|
-// Need to hold (read) lock on both m.fmut and m.pmut when calling this.
|
|
|
|
|
-func (m *model) checkDeviceFolderConnectedLocked(device protocol.DeviceID, folder string) error {
|
|
|
|
|
- if err := m.checkFolderRunningLocked(folder); err != nil {
|
|
|
|
|
- return err
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if cfg, ok := m.cfg.Device(device); !ok {
|
|
|
|
|
- return errDeviceUnknown
|
|
|
|
|
- } else if cfg.Paused {
|
|
|
|
|
- return errDevicePaused
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if _, ok := m.conn[device]; !ok {
|
|
|
|
|
- return errors.New("device is not connected")
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if cfg, ok := m.cfg.Folder(folder); !ok || !cfg.SharedWith(device) {
|
|
|
|
|
- return errors.New("folder is not shared with device")
|
|
|
|
|
- }
|
|
|
|
|
- return nil
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
// mapFolders returns a map of folder ID to folder configuration for the given
|
|
// mapFolders returns a map of folder ID to folder configuration for the given
|
|
|
// slice of folder configurations.
|
|
// slice of folder configurations.
|
|
|
func mapFolders(folders []config.FolderConfiguration) map[string]config.FolderConfiguration {
|
|
func mapFolders(folders []config.FolderConfiguration) map[string]config.FolderConfiguration {
|