1
mirror of https://github.com/rclone/rclone synced 2024-12-19 09:05:56 +01:00

accounting: reset bytes read during copy retry - fixes #4178

During a copy/sync command, if an operation fails due to a network
issue and is retried, the underlying io.Reader is re-initialised,
but the stats for bytes already read are not reset, leading to incorrect
stats. THis was fixed by resetting the bytes read when an Account is
re-initialized.
This commit is contained in:
Ankur Gupta 2020-05-08 18:15:48 +05:30 committed by Nick Craig-Wood
parent 54b16bd054
commit 10a6a92e52

View File

@ -138,6 +138,8 @@ func (acc *Account) UpdateReader(in io.ReadCloser) {
acc.close = in
acc.origIn = in
acc.closed = false
acc.lpBytes = 0
acc.bytes = int64(0)
if withBuf {
acc.WithBuffer()
}