From 9bb5988b4ed726a7eb7662dce01580b0e82dab02 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Thu, 26 May 2016 09:16:08 +0000 Subject: [PATCH] lib/model: Don't deadlock when returning temp index block counts GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3194 --- lib/model/devicedownloadstate.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/model/devicedownloadstate.go b/lib/model/devicedownloadstate.go index e0932bb28..ed9ff7f5f 100644 --- a/lib/model/devicedownloadstate.go +++ b/lib/model/devicedownloadstate.go @@ -140,12 +140,13 @@ func (t *deviceDownloadState) GetBlockCounts(folder string) map[string]int { } t.mut.RLock() + defer t.mut.RUnlock() + for name, state := range t.folders { if name == folder { return state.GetBlockCounts() } } - t.mut.RUnlock() return nil }