mirror of
https://github.com/rclone/rclone.git
synced 2024-11-29 11:55:01 +01:00
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
@ -351,6 +351,8 @@ func (s *StatsInfo) String() string {
|
|||||||
// Transferred returns list of all completed transfers including checked and
|
// Transferred returns list of all completed transfers including checked and
|
||||||
// failed ones.
|
// failed ones.
|
||||||
func (s *StatsInfo) Transferred() []TransferSnapshot {
|
func (s *StatsInfo) Transferred() []TransferSnapshot {
|
||||||
|
s.mu.RLock()
|
||||||
|
defer s.mu.RUnlock()
|
||||||
ts := make([]TransferSnapshot, 0, len(s.startedTransfers))
|
ts := make([]TransferSnapshot, 0, len(s.startedTransfers))
|
||||||
|
|
||||||
for _, tr := range s.startedTransfers {
|
for _, tr := range s.startedTransfers {
|
||||||
|
Loading…
Reference in New Issue
Block a user