guard mesh.json as well

pull/24/head
Zlatin Balevsky 2019-10-28 23:00:03 +00:00
parent 6d587bf228
commit 8df6715e24
1 changed files with 3 additions and 0 deletions

View File

@ -82,6 +82,9 @@ class MeshManager {
JsonSlurper slurper = new JsonSlurper()
meshFile.eachLine {
def json = slurper.parseText(it)
if (json.nPieces == null || json.nPieces == 0)
return // skip it, invalid
if (now - json.timestamp > settings.meshExpiration * 60 * 1000)
return
InfoHash infoHash = new InfoHash(Base64.decode(json.infoHash))