lib/model: Release both locks when waiting for services to stop (fixes #5028)

This commit is contained in:
Simon Frei 2018-06-24 17:55:28 +02:00 committed by Audrius Butkevicius
parent b1b68ceedb
commit 7b0d8c2e77
1 changed files with 2 additions and 0 deletions

View File

@ -344,11 +344,13 @@ func (m *Model) tearDownFolderLocked(cfg config.FolderConfiguration) {
// Stop the services running for this folder and wait for them to finish
// stopping to prevent races on restart.
tokens := m.folderRunnerTokens[cfg.ID]
m.pmut.Unlock()
m.fmut.Unlock()
for _, id := range tokens {
m.RemoveAndWait(id, 0)
}
m.fmut.Lock()
m.pmut.Lock()
// Close connections to affected devices
for _, dev := range cfg.Devices {