"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
sftp: use atomic types
Roberto Ricci28ceb323ee7a
diff --git a/backend/sftp/sftp.go b/backend/sftp/sftp.goindex b402ca713..5b213bf55 100644--- a/backend/sftp/sftp.go+++ b/backend/sftp/sftp.go@@ -503,7 +503,7 @@ type Fs struct {drain *time.Timer // used to drain the pool when we stop using the connectionspacer *fs.Pacer // pacer for operationssavedpswd string- sessions int32 // count in use sessions+ sessions atomic.Int32 // count in use sessions}// Object is a remote SFTP file that has been stat'd (so it exists, but is not necessarily open for reading)@@ -571,17 +571,17 @@ func (c *conn) closed() error {//// Call removeSession() when donefunc (f *Fs) addSession() {- atomic.AddInt32(&f.sessions, 1)+ f.sessions.Add(1)}// Show the ssh session is no longer in usefunc (f *Fs) removeSession() {- atomic.AddInt32(&f.sessions, -1)+ f.sessions.Add(-1)}// getSessions shows whether there are any sessions in usefunc (f *Fs) getSessions() int32 {- return atomic.LoadInt32(&f.sessions)+ return f.sessions.Load()}// Open a new connection to the SFTP server.