Fix chunk manager
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user