i2psnark: Increase min and default bandwidth

Add creation date to created torrents
log tweaks
more test cases
This commit is contained in:
zzz
2015-03-08 20:19:12 +00:00
parent 55161dec17
commit f7337b4891
6 changed files with 19 additions and 9 deletions

View File

@ -74,7 +74,6 @@ public class I2PSnarkUtil {
private static final int EEPGET_CONNECT_TIMEOUT_SHORT = 5*1000;
public static final int DEFAULT_STARTUP_DELAY = 3;
public static final boolean DEFAULT_USE_OPENTRACKERS = true;
public static final int DEFAULT_MAX_UP_BW = 8; //KBps
public static final int MAX_CONNECTIONS = 16; // per torrent
public static final String PROP_MAX_BW = "i2cp.outboundBytesPerSecond";
public static final boolean DEFAULT_USE_DHT = true;
@ -97,7 +96,7 @@ public class I2PSnarkUtil {
setI2CPConfig("127.0.0.1", 7654, null);
_banlist = new ConcurrentHashSet<Hash>();
_maxUploaders = Snark.MAX_TOTAL_UPLOADERS;
_maxUpBW = DEFAULT_MAX_UP_BW;
_maxUpBW = SnarkManager.DEFAULT_MAX_UP_BW;
_maxConnections = MAX_CONNECTIONS;
_startupDelay = DEFAULT_STARTUP_DELAY;
_shouldUseOT = DEFAULT_USE_OPENTRACKERS;

View File

@ -92,7 +92,7 @@ public class MetaInfo
this.announce_list = announce_list;
this.comment = null;
this.created_by = null;
this.creation_date = 0;
this.creation_date = I2PAppContext.getGlobalContext().clock().now();
// TODO if we add a parameter for other keys
//if (other != null) {
@ -444,7 +444,7 @@ public class MetaInfo
/**
* The creation date (ms) or zero.
* Not available for locally-created torrents.
* As of 0.9.19, available for locally-created torrents.
* @since 0.9.7
*/
public long getCreationDate() {
@ -595,6 +595,14 @@ public class MetaInfo
m.put("announce", announce);
if (announce_list != null)
m.put("announce-list", announce_list);
// misc. optional top-level stuff
if (comment != null)
m.put("comment", comment);
if (created_by != null)
m.put("created by", created_by);
if (creation_date != 0)
m.put("creation date", creation_date / 1000);
Map<String, BEValue> info = createInfoMap();
m.put("info", info);
// don't save this locally, we should only do this once

View File

@ -75,6 +75,8 @@ class PeerCheckerTask implements Runnable
List<Peer> removed = new ArrayList<Peer>();
int uploadLimit = coordinator.allowedUploaders();
boolean overBWLimit = coordinator.overUpBWLimit();
if (_log.shouldLog(Log.DEBUG))
_log.debug("peers: " + peerList.size() + " limit: " + uploadLimit + " overBW? " + overBWLimit);
DHT dht = _util.getDHT();
for (Peer peer : peerList) {

View File

@ -1465,8 +1465,8 @@ class PeerCoordinator implements PeerListener
public int allowedUploaders()
{
if (listener != null && listener.overUploadLimit(uploaders)) {
// if (_log.shouldLog(Log.DEBUG))
// _log.debug("Over limit, uploaders was: " + uploaders);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Over limit, uploaders was: " + uploaders);
return uploaders - 1;
} else if (uploaders < MAX_UPLOADERS)
return uploaders + 1;

View File

@ -1288,7 +1288,8 @@ public class Snark
totalUploaders += c.uploaders;
}
int limit = _util.getMaxUploaders();
// debug("Total uploaders: " + totalUploaders + " Limit: " + limit, Snark.DEBUG);
if (_log.shouldLog(Log.DEBUG))
_log.debug("Total uploaders: " + totalUploaders + " Limit: " + limit);
return totalUploaders > limit;
}

View File

@ -118,8 +118,8 @@ public class SnarkManager implements CompleteListener {
public static final String PROP_PRIVATETRACKERS = "i2psnark.privatetrackers";
private static final String PROP_USE_DHT = "i2psnark.enableDHT";
public static final int MIN_UP_BW = 2;
public static final int DEFAULT_MAX_UP_BW = 10;
public static final int MIN_UP_BW = 10;
public static final int DEFAULT_MAX_UP_BW = 25;
public static final int DEFAULT_STARTUP_DELAY = 3;
public static final int DEFAULT_REFRESH_DELAY_SECS = 60;
private static final int DEFAULT_PAGE_SIZE = 50;