diff --git a/apps/i2psnark/java/src/org/klomp/snark/MetaInfo.java b/apps/i2psnark/java/src/org/klomp/snark/MetaInfo.java index 7eef4e49b42e26d7571300d19aa3cdde7609cb6d..a9b70041c8b74af4343a1768daaa261a3a17dee0 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/MetaInfo.java +++ b/apps/i2psnark/java/src/org/klomp/snark/MetaInfo.java @@ -424,13 +424,22 @@ public class MetaInfo } /** + * @return good * @since 0.9.1 */ - boolean checkPiece(PartialPiece pp) throws IOException { + boolean checkPiece(PartialPiece pp) { MessageDigest sha1 = SHA1.getInstance(); int piece = pp.getPiece(); - - byte[] hash = pp.getHash(); + byte[] hash; + try { + hash = pp.getHash(); + } catch (IOException ioe) { + // Could be caused by closing a peer connnection + // we don't want the exception to propagate through + // to Storage.putPiece() + _log.warn("Error checking", ioe); + return false; + } for (int i = 0; i < 20; i++) if (hash[i] != piece_hashes[20 * piece + i]) return false; diff --git a/apps/i2psnark/java/src/org/klomp/snark/PeerState.java b/apps/i2psnark/java/src/org/klomp/snark/PeerState.java index 04e92ba284796a16040fba986bfa95e3ae9dc567..f41bf1b575211bdc048099862b165c69603b430a 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/PeerState.java +++ b/apps/i2psnark/java/src/org/klomp/snark/PeerState.java @@ -308,6 +308,7 @@ class PeerState implements DataLoader + peer); // Last chunk needed for this piece? + // FIXME if priority changed to skip, we will think we're done when we aren't if (getFirstOutstandingRequest(req.getPiece()) == -1) { // warning - may block here for a while