Fix chunk manager

This commit is contained in:
Ben Sarmiento
2023-11-14 16:55:24 +01:00
parent 16505ec33f
commit 4da9416bec
4 changed files with 24 additions and 25 deletions

View File

@@ -108,9 +108,6 @@ func (fs *ZurgFS) Read(path string, buff []byte, ofst int64, fh uint64) (n int)
return -fuse.ENOENT
} else {
size := int64(len(buff))
if size < int64(fs.Config.GetNetworkBufferSize()) {
size = int64(fs.Config.GetNetworkBufferSize())
}
endofst := ofst + size
if endofst > file.Bytes {
endofst = file.Bytes
@@ -118,14 +115,14 @@ func (fs *ZurgFS) Read(path string, buff []byte, ofst int64, fh uint64) (n int)
if endofst < ofst {
return 0
}
// let's request a bigger chunk than we need
if size < int64(fs.Config.GetNetworkBufferSize()) {
size = int64(fs.Config.GetNetworkBufferSize())
}
response, err := fs.Chunk.GetChunk(file, ofst, size)
if err != nil {
return -fuse.ENOENT
}
// response := universal.GetFileReader(torrent, file, ofst, int(size), fs.TorrentManager, fs.Config, fs.Log)
// if response == nil {
// return -fuse.ENOENT
// }
n = copy(buff, response[:endofst-ofst])
return n
}