mirror of https://github.com/zlatinb/muwire
do not use cached length in the core
parent
de88d82936
commit
f0a27005c1
|
@ -88,7 +88,7 @@ class FileCollectionBuilder {
|
|||
comment = ""
|
||||
else
|
||||
comment = DataUtil.readi18nString(Base64.decode(comment))
|
||||
def item = new FileCollectionItem(new InfoHash(sf.root), comment, sfPathElements.get(sf), (byte)sf.pieceSize, sf.getCachedLength())
|
||||
def item = new FileCollectionItem(new InfoHash(sf.root), comment, sfPathElements.get(sf), (byte)sf.pieceSize, sf.getFile().length())
|
||||
files.add(item)
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ class FeedItems {
|
|||
json.version = 1
|
||||
json.name = Base64.encode(DataUtil.encodei18nString(sf.getFile().getName()))
|
||||
json.infoHash = Base64.encode(sf.getRoot())
|
||||
json.size = sf.getCachedLength()
|
||||
json.size = sf.getFile().length()
|
||||
json.pieceSize = sf.getPieceSize()
|
||||
|
||||
if (sf.getComment() != null)
|
||||
|
|
|
@ -144,7 +144,7 @@ abstract class BasePersisterService extends Service{
|
|||
protected static toJson(SharedFile sf) {
|
||||
def json = [:]
|
||||
json.file = Base64.encode(DataUtil.encodei18nString(sf.file.toString()))
|
||||
json.length = sf.getCachedLength()
|
||||
json.length = sf.getFile().length()
|
||||
json.root = Base64.encode(sf.getRoot())
|
||||
json.pieceSize = sf.getPieceSize()
|
||||
json.comment = sf.getComment()
|
||||
|
|
|
@ -39,7 +39,7 @@ class FileMuLink extends MuLink {
|
|||
super(me, sharedFile.getRootInfoHash(), sharedFile.getFile().getName(),
|
||||
deriveSig(sharedFile, spk),
|
||||
LinkType.FILE)
|
||||
fileSize = sharedFile.getCachedLength()
|
||||
fileSize = sharedFile.getFile().length()
|
||||
pieceSizePow2 = sharedFile.getPieceSize()
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ class FileMuLink extends MuLink {
|
|||
daos.write(sharedFile.getRoot())
|
||||
daos.write(sharedFile.getFile().getName().getBytes(StandardCharsets.UTF_8))
|
||||
daos.writeByte(LinkType.FILE.ordinal())
|
||||
daos.writeLong(sharedFile.getCachedLength())
|
||||
daos.writeLong(sharedFile.getFile().length())
|
||||
daos.writeByte(sharedFile.getPieceSize())
|
||||
|
||||
daos.flush()
|
||||
|
|
|
@ -215,7 +215,7 @@ class ResultsSender {
|
|||
obj.version = 2
|
||||
obj.name = encodedName
|
||||
obj.infohash = Base64.encode(sf.getRoot())
|
||||
obj.size = sf.getCachedLength()
|
||||
obj.size = sf.getFile().length()
|
||||
obj.pieceSize = sf.getPieceSize()
|
||||
|
||||
if (sf instanceof DownloadedFile)
|
||||
|
|
Loading…
Reference in New Issue