"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
Protect accounting from being closed twice
Nick Craig-Wooded72c678f8ec
diff --git a/fs/accounting.go b/fs/accounting.goindex 89d293b02..da8901310 100644--- a/fs/accounting.go+++ b/fs/accounting.go@@ -256,6 +256,7 @@ type Account struct {lpTime time.Time // Time of last average measurementlpBytes int // Number of bytes read since last measurementavg ewma.MovingAverage // Moving average of last few measurements+ closed bool // set if the file is closedexit chan struct{} // channel that will be closed when transfer is finished}@@ -408,9 +409,13 @@ func (file *Account) String() string {// Close the objectfunc (file *Account) Close() error {- close(file.exit)file.mu.Lock()defer file.mu.Unlock()+ if file.closed {+ return nil+ }+ file.closed = true+ close(file.exit)Stats.inProgress.clear(file.name)return file.in.Close()}