vfs: Fix over downloading with --vfs-cache-mode full and --buffer-size 0

This was caused by the signal to stop buffering being ignored when
there was no buffer!

This is fixed by explicitly checking for no buffering and stopping.
This commit is contained in:
Nick Craig-Wood 2020-06-26 17:24:36 +01:00
parent 05ddef117a
commit 8301a72453

View File

@ -460,6 +460,14 @@ func (dl *downloader) Write(p []byte) (n int, err error) {
fs.Debugf(dl.dls.src, "stopping download thread as it has skipped %d bytes", dl.skipped)
dl._stop()
}
// If running without a async buffer then stop now as
// StopBuffering has no effect if the Account wasn't buffered
// so we need to stop manually now rather than wait for the
// AsyncReader to stop.
if dl.stop && !dl.in.HasBuffer() {
err = asyncreader.ErrorStreamAbandoned
}
return n, err
}