forked from I2P_Developers/i2p.i2p
* 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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user