lib/model: Don't deadlock when returning temp index block counts

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3194
This commit is contained in:
Jakob Borg 2016-05-26 09:16:08 +00:00
parent c513171014
commit 9bb5988b4e

View File

@ -140,12 +140,13 @@ func (t *deviceDownloadState) GetBlockCounts(folder string) map[string]int {
} }
t.mut.RLock() t.mut.RLock()
defer t.mut.RUnlock()
for name, state := range t.folders { for name, state := range t.folders {
if name == folder { if name == folder {
return state.GetBlockCounts() return state.GetBlockCounts()
} }
} }
t.mut.RUnlock()
return nil return nil
} }