mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-09 14:50:56 +00:00
lib/model: Always release the lock (#5126)
This commit is contained in:
parent
ee42c46bd3
commit
7c0798b622
@ -1307,8 +1307,6 @@ func (m *Model) Request(deviceID protocol.DeviceID, folder, name string, offset
|
||||
return protocol.ErrInvalid
|
||||
}
|
||||
|
||||
m.fmut.RLock()
|
||||
|
||||
if cfg, ok := m.cfg.Folder(folder); !ok || !cfg.SharedWith(deviceID) {
|
||||
l.Warnf("Request from %s for file %s in unshared folder %q", deviceID, name, folder)
|
||||
return protocol.ErrNoSuchFile
|
||||
@ -1317,10 +1315,16 @@ func (m *Model) Request(deviceID protocol.DeviceID, folder, name string, offset
|
||||
return protocol.ErrInvalid
|
||||
}
|
||||
|
||||
folderCfg := m.folderCfgs[folder]
|
||||
m.fmut.RLock()
|
||||
folderCfg, ok := m.folderCfgs[folder]
|
||||
folderIgnores := m.folderIgnores[folder]
|
||||
|
||||
m.fmut.RUnlock()
|
||||
if !ok {
|
||||
// The folder might be already unpaused in the config, but not yet
|
||||
// in the model.
|
||||
l.Debugf("Request from %s for file %s in unstarted folder %q", deviceID, name, folder)
|
||||
return protocol.ErrInvalid
|
||||
}
|
||||
|
||||
// Make sure the path is valid and in canonical form
|
||||
var err error
|
||||
|
Loading…
Reference in New Issue
Block a user