瀏覽代碼

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

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3194
Jakob Borg 9 年之前
父節點
當前提交
9bb5988b4e
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      lib/model/devicedownloadstate.go

+ 2 - 1
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
 }