forked from TrueCloudLab/rclone
accounting: fix data race in Transferred()
startedTransfers is accessed by multiple threads, and it wasn't protected by the mutex call in Transferred() func. Fixes #4799
This commit is contained in:
parent
9d574c0d63
commit
70e8b11805
1 changed files with 2 additions and 0 deletions
|
@ -351,6 +351,8 @@ func (s *StatsInfo) String() string {
|
|||
// Transferred returns list of all completed transfers including checked and
|
||||
// failed ones.
|
||||
func (s *StatsInfo) Transferred() []TransferSnapshot {
|
||||
s.mu.RLock()
|
||||
defer s.mu.RUnlock()
|
||||
ts := make([]TransferSnapshot, 0, len(s.startedTransfers))
|
||||
|
||||
for _, tr := range s.startedTransfers {
|
||||
|
|
Loading…
Reference in a new issue