Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

smb: fix Failed to sync: context canceled at the end of syncs

Nick Craig-Wood705e8f2fe0ab
diff --git a/backend/smb/connpool.go b/backend/smb/connpool.go
index 6f6fe8232..d4bed787c 100644
--- a/backend/smb/connpool.go
+++ b/backend/smb/connpool.go
@@ -103,6 +103,10 @@ func (f *Fs) getSessions() int32 {
// Open a new connection to the SMB server.
func (f *Fs) newConnection(ctx context.Context, share string) (c *conn, err error) {
+ // As we are pooling these connections we need to decouple
+ // them from the current context
+ ctx = context.Background()
+
c, err = f.dial(ctx, "tcp", f.opt.Host+":"+f.opt.Port)
if err != nil {
return nil, fmt.Errorf("couldn't connect SMB: %w", err)