Skip to content

Commit

Permalink
Removed the threadsafe flag from aftp as it cause issues and is not r…
Browse files Browse the repository at this point in the history
…equired for Duplicati's use (backends are not assumed to be threadsafe).

Removed the polling code that checks the file size, as the problem should now be fixed with the removal of the threadsafe flag.
  • Loading branch information
kenkendk committed Oct 22, 2019
1 parent 11f80e3 commit f40746d
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions Duplicati/Library/Backend/AlternativeFTP/AlternativeFTPBackend.cs
Expand Up @@ -352,22 +352,11 @@ public async Task PutAsync(string remotename, Stream input, CancellationToken ca
if (_listVerify)
{
// check remote file size; matching file size indicates completion
var sleepTime = 250;
var maxVerifyMilliseconds = 5000;
var m = maxVerifyMilliseconds;
long remoteSize = 0;
while (m > 0)
var remoteSize = ftpClient.GetFileSize(remotePath);
if (streamLen != remoteSize)
{
remoteSize = ftpClient.GetFileSize(remotePath);
if (streamLen == remoteSize)
{
return;
}
m -= sleepTime;
Thread.Sleep(sleepTime);
throw new UserInformationException(Strings.ListVerifySizeFailure(remotename, remoteSize, streamLen), "AftpListVerifySizeFailure");
}

throw new UserInformationException(Strings.ListVerifySizeFailure(remotename, remoteSize, streamLen), "AftpListVerifySizeFailure");
}
}
catch (FtpCommandException ex)
Expand Down Expand Up @@ -559,7 +548,9 @@ private FtpClient CreateClient()
EncryptionMode = _encryptionMode,
DataConnectionType = _dataConnectionType,
SslProtocols = _sslProtocols,
EnableThreadSafeDataConnections = true, // Required to work properly but can result in up to 3 connections being used even when you expect just one..

// We do not support parallel uploads, and the feature is buggy
EnableThreadSafeDataConnections = false,
};

ftpClient.ValidateCertificate += HandleValidateCertificate;
Expand Down

0 comments on commit f40746d

Please sign in to comment.