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

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

Streaming: Reduce min RTO so that "loopback" connections

recover quicker after packet loss;
Reduce default initial ack delay;
Rename misspelled method
parent cbe91e30
No related branches found
No related tags found
No related merge requests found
......@@ -89,7 +89,7 @@ class Connection {
private final AtomicLong _lifetimeDupMessageReceived = new AtomicLong();
public static final long MAX_RESEND_DELAY = 45*1000;
public static final long MIN_RESEND_DELAY = 750;
public static final long MIN_RESEND_DELAY = 100;
/**
* Wait up to 5 minutes after disconnection so we can ack/close packets.
......
......@@ -129,7 +129,8 @@ class ConnectionOptions extends I2PSocketOptionsImpl {
static final int INITIAL_WINDOW_SIZE = 6;
static final int DEFAULT_MAX_SENDS = 8;
public static final int DEFAULT_INITIAL_RTT = 8*1000;
public static final int DEFAULT_INITIAL_ACK_DELAY = 1000;
private static final int MAX_RTT = 60*1000;
private static final int DEFAULT_INITIAL_ACK_DELAY = 750;
static final int MIN_WINDOW_SIZE = 1;
private static final boolean DEFAULT_ANSWER_PINGS = true;
private static final int DEFAULT_INACTIVITY_TIMEOUT = 90*1000;
......@@ -559,8 +560,8 @@ class ConnectionOptions extends I2PSocketOptionsImpl {
synchronized(this) {
_rtt = ms;
if (_rtt > 60*1000)
_rtt = 60*1000;
if (_rtt > MAX_RTT)
_rtt = MAX_RTT;
}
}
......
......@@ -107,7 +107,7 @@ class ConnectionPacketHandler {
// Here, for the purposes of calculating whether the input stream is full,
// we assume all the not-ready blocks are the max message size.
// This prevents us from getting DoSed by accepting unlimited out-of-order small messages
long ready = con.getInputStream().getHighestReadyBockId();
long ready = con.getInputStream().getHighestReadyBlockId();
int available = con.getOptions().getInboundBufferSize() - con.getInputStream().getTotalReadySize();
int allowedBlocks = available/con.getOptions().getMaxMessageSize();
if (seqNum > ready + allowedBlocks) {
......
......@@ -74,7 +74,7 @@ class MessageInputStream extends InputStream {
/** What is the highest block ID we've completely received through?
* @return highest data block ID completely received or -1 for none
*/
public long getHighestReadyBockId() {
public long getHighestReadyBlockId() {
synchronized (_dataLock) {
return _highestReadyBlockId;
}
......
......@@ -272,7 +272,7 @@ public class PcapWriter {
// TODO just use a recent high unackedIn count?
// following is from ConnectionPacketHandler
// this is not interesting, we have lots of buffers
long ready = con.getInputStream().getHighestReadyBockId();
long ready = con.getInputStream().getHighestReadyBlockId();
int available = con.getOptions().getInboundBufferSize() - con.getInputStream().getTotalReadySize();
int allowedBlocks = available/con.getOptions().getMaxMessageSize();
window = (ready + allowedBlocks) - pkt.getSequenceNum();
......
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