If I understand the Rebex SFTP documentation correctly, the GetFileAsync, PutAsync and GetListAsync can be cancelled with the AbortTransfer method.
It would be great if those methods (and probably more) would have an overload with a CancellationToken, making it consistent with the .NET Framework APIs.
As a workaround, I created wrapper methods which internally work like this:
var state = Guid.NewGuid();
using (cancellationToken.Register(() => sftp.AbortTransfer(state)))
{
await sftp.PutFileAsync(stream, remotePath, state);
}
Is this correct usage of the state / AbortTransfer? Unfortunately, the documentation is a little bit thin here.
Thank you in advance!