* i2psnark: Don't prefer leeches during end game, to

prevent slowdowns or stalls
This commit is contained in:
zzz
2014-07-19 12:48:16 +00:00
parent df81006b42
commit 5d21738410
3 changed files with 13 additions and 7 deletions

View File

@ -1202,22 +1202,23 @@ class PeerCoordinator implements PeerListener
boolean skipped = false;
for(Piece piece : wantedPieces) {
if (piece.getId() == savedPiece) {
if (peer.isCompleted() && piece.getPeerCount() > 1) {
if (peer.isCompleted() && piece.getPeerCount() > 1 &&
wantedPieces.size() > 2*END_GAME_THRESHOLD) {
// Try to preserve rarest-first
// by not requesting a partial piece that non-seeders also have
// by not requesting a partial piece that at least two non-seeders also have
// from a seeder
boolean nonSeeds = false;
int nonSeeds = 0;
for (Peer pr : peers) {
PeerState state = pr.state;
if (state == null) continue;
BitField bf = state.bitfield;
if (bf == null) continue;
if (bf.get(savedPiece) && !pr.isCompleted()) {
nonSeeds = true;
break;
if (++nonSeeds > 1)
break;
}
}
if (nonSeeds) {
if (nonSeeds > 1) {
skipped = true;
break;
}

View File

@ -1,3 +1,8 @@
2014-07-19 zzz
* i2psnark: Don't prefer leeches during end game, to
prevent slowdowns or stalls
* Streaming; Disable fail-fast for now.
2014-07-15 str4d
* I2CP: Stubs for I2CP connections over Unix domain sockets

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 15;
public final static long BUILD = 16;
/** for example "-test" */
public final static String EXTRA = "";