diff --git a/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java b/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java index ce4a0658ac8a7ac1b6889d0dd16df64e68a505b8..e1785034cd9a9565c8621e3588f6e434970feca8 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java +++ b/apps/i2psnark/java/src/org/klomp/snark/PeerCoordinator.java @@ -75,6 +75,7 @@ public class PeerCoordinator implements PeerListener for(int i = 0; i < metainfo.getPieces(); i++) if (!bitfield.get(i)) wantedPieces.add(new Piece(i)); + Collections.shuffle(wantedPieces); // Install a timer to check the uploaders. timer.schedule(new PeerCheckerTask(this), CHECK_PERIOD, CHECK_PERIOD); diff --git a/apps/i2psnark/java/src/org/klomp/snark/Piece.java b/apps/i2psnark/java/src/org/klomp/snark/Piece.java index d98421b99252babe3f3564b05d10f1d65c2e738c..817bdce83f5a567ee74f3b37b92e7856b3d87122 100644 --- a/apps/i2psnark/java/src/org/klomp/snark/Piece.java +++ b/apps/i2psnark/java/src/org/klomp/snark/Piece.java @@ -12,6 +12,7 @@ public class Piece implements Comparable { public Piece(int id) { this.id = id; this.peers = new HashSet(); + this.requested = false; } public int compareTo(Object o) throws ClassCastException {