diff --git a/Duplicati/Library/Utility/ThrottledStream.cs b/Duplicati/Library/Utility/ThrottledStream.cs index 7f30856ec..5a681baec 100644 --- a/Duplicati/Library/Utility/ThrottledStream.cs +++ b/Duplicati/Library/Utility/ThrottledStream.cs @@ -153,7 +153,8 @@ namespace Duplicati.Library.Utility /// The offset into the buffer. /// The number of bytes to write. public override void Write(byte[] buffer, int offset, int count) - { + { + int bytesWritten = 0; while (count > 0) { // To avoid excessive waiting, the delay will wait at most 2 seconds, @@ -161,10 +162,10 @@ namespace Duplicati.Library.Utility UpdateLimits(); var chunksize = (int)Math.Min(count, m_writespeed <= 0 ? count : m_writespeed * 2); DelayIfRequired(ref m_writespeed, chunksize, ref m_last_write_sample, ref m_current_write_counter, ref m_current_write_speed); - m_basestream.Write(buffer, offset, chunksize); + m_basestream.Write(buffer, offset + bytesWritten, chunksize); m_current_write_counter += chunksize; - + bytesWritten += chunksize; count -= chunksize; } }