* i2psnark:

- Adjust target piece size calculation
   - Tweak to make it easier for new peers to connect
This commit is contained in:
zzz
2013-05-15 14:18:24 +00:00
parent de6bb12b95
commit 2ba5ad558b
2 changed files with 3 additions and 3 deletions

View File

@ -376,10 +376,10 @@ class PeerCoordinator implements PeerListener
*/ */
public boolean needOutboundPeers() { public boolean needOutboundPeers() {
//return wantedBytes != 0 && needPeers(); //return wantedBytes != 0 && needPeers();
// minus one to make it a little easier for new peers to get in on large swarms // minus two to make it a little easier for new peers to get in on large swarms
return wantedBytes != 0 && return wantedBytes != 0 &&
!halted && !halted &&
peers.size() < getMaxConnections() - 1 && peers.size() < getMaxConnections() - 2 &&
(storage == null || !storage.isChecking()); (storage == null || !storage.isChecking());
} }

View File

@ -154,7 +154,7 @@ public class Storage
else else
pc_size = DEFAULT_PIECE_SIZE; pc_size = DEFAULT_PIECE_SIZE;
int pcs = (int) ((total - 1)/pc_size) + 1; int pcs = (int) ((total - 1)/pc_size) + 1;
while (pcs > MAX_PIECES && pc_size < MAX_PIECE_SIZE) while (pcs > (MAX_PIECES * 2 / 3) && pc_size < MAX_PIECE_SIZE)
{ {
pc_size *= 2; pc_size *= 2;
pcs = (int) ((total - 1)/pc_size) +1; pcs = (int) ((total - 1)/pc_size) +1;