forked from I2P_Developers/i2p.i2p
i2psnark: Increase max pipeline, negotiate actual value
This commit is contained in:
@ -43,12 +43,12 @@ interface CoordinatorListener
|
|||||||
public boolean overUploadLimit(int uploaders);
|
public boolean overUploadLimit(int uploaders);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Are we currently over the upstream bandwidth limit?
|
* Is i2psnark as a whole over its limit?
|
||||||
*/
|
*/
|
||||||
public boolean overUpBWLimit();
|
public boolean overUpBWLimit();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the total (in Bps) over the upstream bandwidth limit?
|
* Is a particular peer who has this recent download rate (in Bps) over our upstream bandwidth limit?
|
||||||
*/
|
*/
|
||||||
public boolean overUpBWLimit(long total);
|
public boolean overUpBWLimit(long total);
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ abstract class ExtensionHandler {
|
|||||||
handshake.put("m", m);
|
handshake.put("m", m);
|
||||||
handshake.put("p", Integer.valueOf(TrackerClient.PORT));
|
handshake.put("p", Integer.valueOf(TrackerClient.PORT));
|
||||||
handshake.put("v", "I2PSnark");
|
handshake.put("v", "I2PSnark");
|
||||||
handshake.put("reqq", Integer.valueOf(5));
|
handshake.put("reqq", Integer.valueOf(PeerState.MAX_PIPELINE));
|
||||||
// BEP 21
|
// BEP 21
|
||||||
if (uploadOnly)
|
if (uploadOnly)
|
||||||
handshake.put("upload_only", Integer.valueOf(1));
|
handshake.put("upload_only", Integer.valueOf(1));
|
||||||
|
@ -38,6 +38,7 @@ import net.i2p.data.Destination;
|
|||||||
import net.i2p.util.Log;
|
import net.i2p.util.Log;
|
||||||
|
|
||||||
import org.klomp.snark.bencode.BEValue;
|
import org.klomp.snark.bencode.BEValue;
|
||||||
|
import org.klomp.snark.bencode.InvalidBEncodingException;
|
||||||
|
|
||||||
public class Peer implements Comparable<Peer>
|
public class Peer implements Comparable<Peer>
|
||||||
{
|
{
|
||||||
@ -92,6 +93,7 @@ public class Peer implements Comparable<Peer>
|
|||||||
private long options;
|
private long options;
|
||||||
private final boolean _isIncoming;
|
private final boolean _isIncoming;
|
||||||
private int _totalCommentsSent;
|
private int _totalCommentsSent;
|
||||||
|
private int _maxPipeline = PeerState.MIN_PIPELINE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outgoing connection.
|
* Outgoing connection.
|
||||||
@ -428,9 +430,30 @@ public class Peer implements Comparable<Peer>
|
|||||||
return handshakeMap;
|
return handshakeMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @since 0.8.4 */
|
/**
|
||||||
|
* @param map non-null
|
||||||
|
* @since 0.8.4
|
||||||
|
*/
|
||||||
public void setHandshakeMap(Map<String, BEValue> map) {
|
public void setHandshakeMap(Map<String, BEValue> map) {
|
||||||
handshakeMap = map;
|
handshakeMap = map;
|
||||||
|
BEValue bev = map.get("reqq");
|
||||||
|
if (bev != null) {
|
||||||
|
try {
|
||||||
|
int reqq = bev.getInt();
|
||||||
|
_maxPipeline = Math.min(PeerState.MAX_PIPELINE, Math.max(PeerState.MIN_PIPELINE, reqq));
|
||||||
|
} catch (InvalidBEncodingException ibee) {}
|
||||||
|
} else {
|
||||||
|
// BEP 10 "The default in libtorrent is 250"
|
||||||
|
_maxPipeline = PeerState.MAX_PIPELINE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return min of PeerState.MIN_PIPELINE, max of PeerState.MAX_PIPELINE
|
||||||
|
* @since 0.9.47
|
||||||
|
*/
|
||||||
|
public int getMaxPipeline() {
|
||||||
|
return _maxPipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @since 0.8.4 */
|
/** @since 0.8.4 */
|
||||||
@ -644,7 +667,8 @@ public class Peer implements Comparable<Peer>
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of bytes that have been downloaded.
|
* Returns the number of bytes that have been downloaded.
|
||||||
* Can be reset to zero with <code>resetCounters()</code>/
|
* Can be reset to zero with <code>resetCounters()</code>
|
||||||
|
* which is called every CHECK_PERIOD by PeerCheckerTask.
|
||||||
*/
|
*/
|
||||||
public long getDownloaded()
|
public long getDownloaded()
|
||||||
{
|
{
|
||||||
@ -653,7 +677,8 @@ public class Peer implements Comparable<Peer>
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the number of bytes that have been uploaded.
|
* Returns the number of bytes that have been uploaded.
|
||||||
* Can be reset to zero with <code>resetCounters()</code>/
|
* Can be reset to zero with <code>resetCounters()</code>
|
||||||
|
* which is called every CHECK_PERIOD by PeerCheckerTask.
|
||||||
*/
|
*/
|
||||||
public long getUploaded()
|
public long getUploaded()
|
||||||
{
|
{
|
||||||
|
@ -69,9 +69,12 @@ class PeerState implements DataLoader
|
|||||||
private Request lastRequest = null;
|
private Request lastRequest = null;
|
||||||
|
|
||||||
// FIXME if piece size < PARTSIZE, pipeline could be bigger
|
// FIXME if piece size < PARTSIZE, pipeline could be bigger
|
||||||
private final static int MAX_PIPELINE = 5; // this is for outbound requests
|
/** @since 0.9.47 */
|
||||||
private final static int MAX_PIPELINE_BYTES = 128*1024; // this is for inbound requests
|
public static final int MIN_PIPELINE = 5; // this is for outbound requests
|
||||||
|
/** @since public since 0.9.47 */
|
||||||
|
public static final int MAX_PIPELINE = 8; // this is for outbound requests
|
||||||
public final static int PARTSIZE = 16*1024; // outbound request
|
public final static int PARTSIZE = 16*1024; // outbound request
|
||||||
|
private final static int MAX_PIPELINE_BYTES = (MAX_PIPELINE + 2) * PARTSIZE; // this is for inbound requests
|
||||||
private final static int MAX_PARTSIZE = 64*1024; // Don't let anybody request more than this
|
private final static int MAX_PARTSIZE = 64*1024; // Don't let anybody request more than this
|
||||||
private static final Integer PIECE_ALL = Integer.valueOf(-1);
|
private static final Integer PIECE_ALL = Integer.valueOf(-1);
|
||||||
|
|
||||||
@ -259,9 +262,9 @@ class PeerState implements DataLoader
|
|||||||
if (bev != null) {
|
if (bev != null) {
|
||||||
try {
|
try {
|
||||||
if (bev.getMap().get(ExtensionHandler.TYPE_COMMENT) != null) {
|
if (bev.getMap().get(ExtensionHandler.TYPE_COMMENT) != null) {
|
||||||
if (_log.shouldLog(Log.WARN))
|
if (_log.shouldDebug())
|
||||||
_log.warn("Allowing seed that connects to seeds for comments: " + peer);
|
_log.debug("Allowing seed that connects to seeds for comments: " + peer);
|
||||||
setInteresting(interest);
|
setInteresting(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (InvalidBEncodingException ibee) {}
|
} catch (InvalidBEncodingException ibee) {}
|
||||||
@ -880,7 +883,7 @@ class PeerState implements DataLoader
|
|||||||
boolean more_pieces = true;
|
boolean more_pieces = true;
|
||||||
while (more_pieces)
|
while (more_pieces)
|
||||||
{
|
{
|
||||||
more_pieces = outstandingRequests.size() < MAX_PIPELINE;
|
more_pieces = outstandingRequests.size() < peer.getMaxPipeline();
|
||||||
// We want something and we don't have outstanding requests?
|
// We want something and we don't have outstanding requests?
|
||||||
if (more_pieces && lastRequest == null) {
|
if (more_pieces && lastRequest == null) {
|
||||||
// we have nothing in the queue right now
|
// we have nothing in the queue right now
|
||||||
|
13
history.txt
13
history.txt
@ -1,5 +1,16 @@
|
|||||||
|
2020-07-19 zzz
|
||||||
|
* i2psnark: Increase max pipeline, negotiate actual value
|
||||||
|
|
||||||
|
2020-07-11 zzz
|
||||||
|
* NTCP: Atomics for NTCP final state (ticket #2701)
|
||||||
|
* OCMOSJ: Don't lookup an expiring LS2 if unpublished
|
||||||
|
|
||||||
|
2020-07-07 zzz
|
||||||
|
* i2psnark: Change ETA default sort order (ticket #2733)
|
||||||
|
* Reseed: Enforce minimum version in generated bundle
|
||||||
|
|
||||||
2020-07-02 zzz
|
2020-07-02 zzz
|
||||||
* i2ptunnel: Fix missing throttling section for non-HTTP servers
|
* i2ptunnel: Fix missing throttling section for non-HTTP servers (ticket #2758)
|
||||||
|
|
||||||
2020-06-28 zzz
|
2020-06-28 zzz
|
||||||
* NetDB: Check signature in verify
|
* NetDB: Check signature in verify
|
||||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 7;
|
public final static long BUILD = 8;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
|
Reference in New Issue
Block a user