* i2psnark:

- Store received chunks in temp files
   - Don't allocate from heap for unneeded chunks
   - Remove peer count restriction for torrents with large pieces
   - Use priorities and rarest calculations to sort partials
   - Preserve p parameter in clear messages link
This commit is contained in:
zzz
2012-05-19 13:27:02 +00:00
parent 3685bf04d0
commit 6ca4b519bf
15 changed files with 430 additions and 166 deletions

View File

@@ -422,6 +422,20 @@ public class MetaInfo
return false;
return true;
}
/**
* @since 0.9.1
*/
boolean checkPiece(PartialPiece pp) throws IOException {
MessageDigest sha1 = SHA1.getInstance();
int piece = pp.getPiece();
byte[] hash = pp.getHash();
for (int i = 0; i < 20; i++)
if (hash[i] != piece_hashes[20 * piece + i])
return false;
return true;
}
/**
* Returns the total length of the torrent in bytes.