* i2psnark:

- More listing fixes (more thanks to 'backup')
      - Start end game a little sooner
This commit is contained in:
zzz
2010-06-01 22:19:10 +00:00
parent 4a863f8ce7
commit cd35b219db
5 changed files with 13 additions and 4 deletions

View File

@ -388,6 +388,7 @@ public class Peer implements Comparable
* Sets whether or not we are interested in pieces from this peer.
* Defaults to false. When interest is true and this peer unchokes
* us then we start downloading from it. Has no effect when not connected.
* @deprecated unused
*/
public void setInteresting(boolean interest)
{

View File

@ -489,6 +489,13 @@ public class PeerCoordinator implements PeerListener
return false;
}
/**
* This should be somewhat less than the max conns per torrent,
* but not too much less, so a torrent doesn't get stuck near the end.
* @since 0.7.14
*/
private static final int END_GAME_THRESHOLD = 8;
/**
* Returns one of pieces in the given BitField that is still wanted or
* -1 if none of the given pieces are wanted.
@ -525,7 +532,7 @@ public class PeerCoordinator implements PeerListener
// AND if there are almost no wanted pieces left (real end game).
// If we do end game all the time, we generate lots of extra traffic
// when the seeder is super-slow and all the peers are "caught up"
if (wantedPieces.size() > 4)
if (wantedPieces.size() > END_GAME_THRESHOLD)
return -1; // nothing to request and not in end game
// let's not all get on the same piece
Collections.shuffle(requested);

View File

@ -697,7 +697,7 @@ public class I2PSnarkServlet extends Default {
if (snark.meta.getFiles() != null)
icon = "folder";
else
icon = toIcon(fullFilename);
icon = toIcon(snark.meta.getName());
out.write(toImg(icon));
out.write(filename);
if (remaining == 0 || snark.meta.getFiles() != null)