code: 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
  }
docs: // 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.