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 = ""
|
comment = ""
|
||||||
else
|
else
|
||||||
comment = DataUtil.readi18nString(Base64.decode(comment))
|
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)
|
files.add(item)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class FeedItems {
|
||||||
json.version = 1
|
json.version = 1
|
||||||
json.name = Base64.encode(DataUtil.encodei18nString(sf.getFile().getName()))
|
json.name = Base64.encode(DataUtil.encodei18nString(sf.getFile().getName()))
|
||||||
json.infoHash = Base64.encode(sf.getRoot())
|
json.infoHash = Base64.encode(sf.getRoot())
|
||||||
json.size = sf.getCachedLength()
|
json.size = sf.getFile().length()
|
||||||
json.pieceSize = sf.getPieceSize()
|
json.pieceSize = sf.getPieceSize()
|
||||||
|
|
||||||
if (sf.getComment() != null)
|
if (sf.getComment() != null)
|
||||||
|
|
|
@ -144,7 +144,7 @@ abstract class BasePersisterService extends Service{
|
||||||
protected static toJson(SharedFile sf) {
|
protected static toJson(SharedFile sf) {
|
||||||
def json = [:]
|
def json = [:]
|
||||||
json.file = Base64.encode(DataUtil.encodei18nString(sf.file.toString()))
|
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.root = Base64.encode(sf.getRoot())
|
||||||
json.pieceSize = sf.getPieceSize()
|
json.pieceSize = sf.getPieceSize()
|
||||||
json.comment = sf.getComment()
|
json.comment = sf.getComment()
|
||||||
|
|
|
@ -39,7 +39,7 @@ class FileMuLink extends MuLink {
|
||||||
super(me, sharedFile.getRootInfoHash(), sharedFile.getFile().getName(),
|
super(me, sharedFile.getRootInfoHash(), sharedFile.getFile().getName(),
|
||||||
deriveSig(sharedFile, spk),
|
deriveSig(sharedFile, spk),
|
||||||
LinkType.FILE)
|
LinkType.FILE)
|
||||||
fileSize = sharedFile.getCachedLength()
|
fileSize = sharedFile.getFile().length()
|
||||||
pieceSizePow2 = sharedFile.getPieceSize()
|
pieceSizePow2 = sharedFile.getPieceSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class FileMuLink extends MuLink {
|
||||||
daos.write(sharedFile.getRoot())
|
daos.write(sharedFile.getRoot())
|
||||||
daos.write(sharedFile.getFile().getName().getBytes(StandardCharsets.UTF_8))
|
daos.write(sharedFile.getFile().getName().getBytes(StandardCharsets.UTF_8))
|
||||||
daos.writeByte(LinkType.FILE.ordinal())
|
daos.writeByte(LinkType.FILE.ordinal())
|
||||||
daos.writeLong(sharedFile.getCachedLength())
|
daos.writeLong(sharedFile.getFile().length())
|
||||||
daos.writeByte(sharedFile.getPieceSize())
|
daos.writeByte(sharedFile.getPieceSize())
|
||||||
|
|
||||||
daos.flush()
|
daos.flush()
|
||||||
|
|
|
@ -215,7 +215,7 @@ class ResultsSender {
|
||||||
obj.version = 2
|
obj.version = 2
|
||||||
obj.name = encodedName
|
obj.name = encodedName
|
||||||
obj.infohash = Base64.encode(sf.getRoot())
|
obj.infohash = Base64.encode(sf.getRoot())
|
||||||
obj.size = sf.getCachedLength()
|
obj.size = sf.getFile().length()
|
||||||
obj.pieceSize = sf.getPieceSize()
|
obj.pieceSize = sf.getPieceSize()
|
||||||
|
|
||||||
if (sf instanceof DownloadedFile)
|
if (sf instanceof DownloadedFile)
|
||||||
|
|
Loading…
Reference in New Issue