mirror of
https://github.com/rclone/rclone.git
synced 2025-01-05 13:59:25 +01:00
smb: fix Failed to sync: context canceled at the end of syncs
Before this change we were putting connections into the connection pool which had a local context in. This meant that when the operation had finished the context was cancelled and the connection became unusable. See: https://forum.rclone.org/t/failed-to-sync-context-canceled/34017/
This commit is contained in:
parent
4ffe9dcfef
commit
567d8fc8d1
@ -103,6 +103,10 @@ func (f *Fs) getSessions() int32 {
|
|||||||
|
|
||||||
// Open a new connection to the SMB server.
|
// Open a new connection to the SMB server.
|
||||||
func (f *Fs) newConnection(ctx context.Context, share string) (c *conn, err error) {
|
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)
|
c, err = f.dial(ctx, "tcp", f.opt.Host+":"+f.opt.Port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("couldn't connect SMB: %w", err)
|
return nil, fmt.Errorf("couldn't connect SMB: %w", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user