Ver Fonte

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

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3194
Jakob Borg há 9 anos atrás
pai
commit
9bb5988b4e
1 ficheiros alterados com 2 adições e 1 exclusões
  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
 }