1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-15 15:53:41 +00:00

fuse: Add bandwidth accounting and buffering

This fixes rclone mount ignoring bwlimit and increases buffering which
should speed up transfers greatly.

Fixes #796
Fixes #690
This commit is contained in:
Nick Craig-Wood
2016-11-30 20:18:14 +00:00
parent 2cbdb95ce5
commit be4fd51289
4 changed files with 34 additions and 16 deletions

View File

@@ -38,8 +38,9 @@ func newWriteFileHandle(d *Dir, f *File, src fs.ObjectInfo) (*WriteFileHandle, e
file: f,
}
fh.pipeReader, fh.pipeWriter = io.Pipe()
r := fs.NewAccountSizeName(fh.pipeReader, 0, src.Remote()) // account and buffer the transfer
go func() {
o, err := d.f.Put(fh.pipeReader, src)
o, err := d.f.Put(r, src)
fh.o = o
fh.result <- err
}()