I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit cbef38ac authored by zzz's avatar zzz
Browse files

* i2psnark: Restrict swarm size for small torrents

parent f9ffab62
No related branches found
No related tags found
No related merge requests found
...@@ -342,6 +342,11 @@ public class PeerCoordinator implements PeerListener ...@@ -342,6 +342,11 @@ public class PeerCoordinator implements PeerListener
private int getMaxConnections() { private int getMaxConnections() {
if (metainfo == null) if (metainfo == null)
return 6; return 6;
int pieces = metainfo.getPieces();
if (pieces <= 2)
return 4;
if (pieces <= 5)
return 6;
int size = metainfo.getPieceLength(0); int size = metainfo.getPieceLength(0);
int max = _util.getMaxConnections(); int max = _util.getMaxConnections();
if (size <= 512*1024 || completed()) if (size <= 512*1024 || completed())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment