forked from I2P_Developers/i2p.i2p
i2psnark:
- Consolidate default tunnel length definition - Increase max peers and uploaders per torrent - Increase default max total uploaders - Increase max peers sent and returned in DHT
This commit is contained in:
@ -75,7 +75,7 @@ public class I2PSnarkUtil {
|
|||||||
private static final int EEPGET_CONNECT_TIMEOUT_SHORT = 5*1000;
|
private static final int EEPGET_CONNECT_TIMEOUT_SHORT = 5*1000;
|
||||||
public static final int DEFAULT_STARTUP_DELAY = 3;
|
public static final int DEFAULT_STARTUP_DELAY = 3;
|
||||||
public static final boolean DEFAULT_USE_OPENTRACKERS = true;
|
public static final boolean DEFAULT_USE_OPENTRACKERS = true;
|
||||||
public static final int MAX_CONNECTIONS = 16; // per torrent
|
public static final int MAX_CONNECTIONS = 24; // per torrent
|
||||||
public static final String PROP_MAX_BW = "i2cp.outboundBytesPerSecond";
|
public static final String PROP_MAX_BW = "i2cp.outboundBytesPerSecond";
|
||||||
public static final boolean DEFAULT_USE_DHT = true;
|
public static final boolean DEFAULT_USE_DHT = true;
|
||||||
public static final String EEPGET_USER_AGENT = "I2PSnark";
|
public static final String EEPGET_USER_AGENT = "I2PSnark";
|
||||||
|
@ -120,10 +120,10 @@ class IdleChecker extends SimpleTimer2.TimedEvent {
|
|||||||
Map<String, String> opts = _util.getI2CPOptions();
|
Map<String, String> opts = _util.getI2CPOptions();
|
||||||
String i = opts.get("inbound.quantity");
|
String i = opts.get("inbound.quantity");
|
||||||
if (i == null)
|
if (i == null)
|
||||||
i = "3";
|
i = Integer.toString(SnarkManager.DEFAULT_TUNNEL_QUANTITY);
|
||||||
String o = opts.get("outbound.quantity");
|
String o = opts.get("outbound.quantity");
|
||||||
if (o == null)
|
if (o == null)
|
||||||
o = "3";
|
o = Integer.toString(SnarkManager.DEFAULT_TUNNEL_QUANTITY);
|
||||||
String ib = opts.get("inbound.backupQuantity");
|
String ib = opts.get("inbound.backupQuantity");
|
||||||
if (ib == null)
|
if (ib == null)
|
||||||
ib = "0";
|
ib = "0";
|
||||||
|
@ -70,7 +70,7 @@ class PeerCoordinator implements PeerListener
|
|||||||
|
|
||||||
// package local for access by CheckDownLoadersTask
|
// package local for access by CheckDownLoadersTask
|
||||||
final static long CHECK_PERIOD = 40*1000; // 40 seconds
|
final static long CHECK_PERIOD = 40*1000; // 40 seconds
|
||||||
final static int MAX_UPLOADERS = 6;
|
final static int MAX_UPLOADERS = 8;
|
||||||
public static final long MAX_INACTIVE = 8*60*1000;
|
public static final long MAX_INACTIVE = 8*60*1000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -403,7 +403,7 @@ class PeerCoordinator implements PeerListener
|
|||||||
* Formerly used to
|
* Formerly used to
|
||||||
* reduce max if huge pieces to keep from ooming when leeching
|
* reduce max if huge pieces to keep from ooming when leeching
|
||||||
* but now we don't
|
* but now we don't
|
||||||
* @return usually 16
|
* @return usually I2PSnarkUtil.MAX_CONNECTIONS
|
||||||
*/
|
*/
|
||||||
private int getMaxConnections() {
|
private int getMaxConnections() {
|
||||||
if (metainfo == null)
|
if (metainfo == null)
|
||||||
|
@ -1329,7 +1329,7 @@ public class Snark
|
|||||||
* coordinatorListener
|
* coordinatorListener
|
||||||
*/
|
*/
|
||||||
final static int MIN_TOTAL_UPLOADERS = 4;
|
final static int MIN_TOTAL_UPLOADERS = 4;
|
||||||
final static int MAX_TOTAL_UPLOADERS = 10;
|
final static int MAX_TOTAL_UPLOADERS = 20;
|
||||||
|
|
||||||
public boolean overUploadLimit(int uploaders) {
|
public boolean overUploadLimit(int uploaders) {
|
||||||
if (_peerCoordinatorSet == null || uploaders <= 0)
|
if (_peerCoordinatorSet == null || uploaders <= 0)
|
||||||
|
@ -133,6 +133,7 @@ public class SnarkManager implements CompleteListener {
|
|||||||
public static final int DEFAULT_STARTUP_DELAY = 3;
|
public static final int DEFAULT_STARTUP_DELAY = 3;
|
||||||
public static final int DEFAULT_REFRESH_DELAY_SECS = 60;
|
public static final int DEFAULT_REFRESH_DELAY_SECS = 60;
|
||||||
private static final int DEFAULT_PAGE_SIZE = 50;
|
private static final int DEFAULT_PAGE_SIZE = 50;
|
||||||
|
public static final int DEFAULT_TUNNEL_QUANTITY = 3;
|
||||||
public static final String CONFIG_DIR_SUFFIX = ".d";
|
public static final String CONFIG_DIR_SUFFIX = ".d";
|
||||||
private static final String SUBDIR_PREFIX = "s";
|
private static final String SUBDIR_PREFIX = "s";
|
||||||
private static final String B64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-~";
|
private static final String B64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-~";
|
||||||
@ -610,7 +611,9 @@ public class SnarkManager implements CompleteListener {
|
|||||||
if (!_config.containsKey(PROP_I2CP_PORT))
|
if (!_config.containsKey(PROP_I2CP_PORT))
|
||||||
_config.setProperty(PROP_I2CP_PORT, "7654");
|
_config.setProperty(PROP_I2CP_PORT, "7654");
|
||||||
if (!_config.containsKey(PROP_I2CP_OPTS))
|
if (!_config.containsKey(PROP_I2CP_OPTS))
|
||||||
_config.setProperty(PROP_I2CP_OPTS, "inbound.length=3 outbound.length=3 inbound.quantity=3 outbound.quantity=3");
|
_config.setProperty(PROP_I2CP_OPTS, "inbound.length=3 outbound.length=3" +
|
||||||
|
" inbound.quantity=" + DEFAULT_TUNNEL_QUANTITY +
|
||||||
|
" outbound.quantity=" + DEFAULT_TUNNEL_QUANTITY);
|
||||||
//if (!_config.containsKey(PROP_EEP_HOST))
|
//if (!_config.containsKey(PROP_EEP_HOST))
|
||||||
// _config.setProperty(PROP_EEP_HOST, "127.0.0.1");
|
// _config.setProperty(PROP_EEP_HOST, "127.0.0.1");
|
||||||
//if (!_config.containsKey(PROP_EEP_PORT))
|
//if (!_config.containsKey(PROP_EEP_PORT))
|
||||||
|
@ -40,6 +40,7 @@ import net.i2p.util.I2PAppThread;
|
|||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
import net.i2p.util.SimpleTimer2;
|
import net.i2p.util.SimpleTimer2;
|
||||||
|
|
||||||
|
import org.klomp.snark.I2PSnarkUtil;
|
||||||
import org.klomp.snark.SnarkManager;
|
import org.klomp.snark.SnarkManager;
|
||||||
import org.klomp.snark.TrackerClient;
|
import org.klomp.snark.TrackerClient;
|
||||||
import org.klomp.snark.bencode.BDecoder;
|
import org.klomp.snark.bencode.BDecoder;
|
||||||
@ -128,8 +129,10 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
|
|||||||
|
|
||||||
/** Max number of nodes to return. BEP 5 says 8 */
|
/** Max number of nodes to return. BEP 5 says 8 */
|
||||||
private static final int K = 8;
|
private static final int K = 8;
|
||||||
/** Max number of peers to return. BEP 5 doesn't say. We'll use the same as I2PSnarkUtil.MAX_CONNECTIONS */
|
/** Max number of peers to return. BEP 5 doesn't say.
|
||||||
private static final int MAX_WANT = 16;
|
* We'll use more than I2PSnarkUtil.MAX_CONNECTIONS since lots could be old.
|
||||||
|
*/
|
||||||
|
private static final int MAX_WANT = I2PSnarkUtil.MAX_CONNECTIONS * 3 / 2;
|
||||||
|
|
||||||
/** overloads error codes which start with 201 */
|
/** overloads error codes which start with 201 */
|
||||||
private static final int REPLY_NONE = 0;
|
private static final int REPLY_NONE = 0;
|
||||||
@ -1412,7 +1415,7 @@ public class KRPC implements I2PSessionMuxedListener, DHT {
|
|||||||
private List<Hash> receivePeers(NodeInfo nInfo, List<BEValue> peers) throws InvalidBEncodingException {
|
private List<Hash> receivePeers(NodeInfo nInfo, List<BEValue> peers) throws InvalidBEncodingException {
|
||||||
if (_log.shouldLog(Log.INFO))
|
if (_log.shouldLog(Log.INFO))
|
||||||
_log.info("Rcvd peers from: " + nInfo);
|
_log.info("Rcvd peers from: " + nInfo);
|
||||||
int max = Math.min(MAX_WANT, peers.size());
|
int max = Math.min(MAX_WANT * 2, peers.size());
|
||||||
List<Hash> rv = new ArrayList<Hash>(max);
|
List<Hash> rv = new ArrayList<Hash>(max);
|
||||||
for (BEValue bev : peers) {
|
for (BEValue bev : peers) {
|
||||||
byte[] b = bev.getBytes();
|
byte[] b = bev.getBytes();
|
||||||
|
@ -2305,13 +2305,15 @@ public class I2PSnarkServlet extends BasicServlet {
|
|||||||
out.write("<tr><td>");
|
out.write("<tr><td>");
|
||||||
out.write(_t("Inbound Settings"));
|
out.write(_t("Inbound Settings"));
|
||||||
out.write(":<td>");
|
out.write(":<td>");
|
||||||
out.write(renderOptions(1, 10, 3, options.remove("inbound.quantity"), "inbound.quantity", TUNNEL));
|
out.write(renderOptions(1, 10, SnarkManager.DEFAULT_TUNNEL_QUANTITY,
|
||||||
|
options.remove("inbound.quantity"), "inbound.quantity", TUNNEL));
|
||||||
out.write(" ");
|
out.write(" ");
|
||||||
out.write(renderOptions(0, 4, 3, options.remove("inbound.length"), "inbound.length", HOP));
|
out.write(renderOptions(0, 4, 3, options.remove("inbound.length"), "inbound.length", HOP));
|
||||||
out.write("<tr><td>");
|
out.write("<tr><td>");
|
||||||
out.write(_t("Outbound Settings"));
|
out.write(_t("Outbound Settings"));
|
||||||
out.write(":<td>");
|
out.write(":<td>");
|
||||||
out.write(renderOptions(1, 10, 3, options.remove("outbound.quantity"), "outbound.quantity", TUNNEL));
|
out.write(renderOptions(1, 10, SnarkManager.DEFAULT_TUNNEL_QUANTITY,
|
||||||
|
options.remove("outbound.quantity"), "outbound.quantity", TUNNEL));
|
||||||
out.write(" ");
|
out.write(" ");
|
||||||
out.write(renderOptions(0, 4, 3, options.remove("outbound.length"), "outbound.length", HOP));
|
out.write(renderOptions(0, 4, 3, options.remove("outbound.length"), "outbound.length", HOP));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user