Streaming: Reduce min RTO so that "loopback" connections

recover quicker after packet loss;
Reduce default initial ack delay;
Rename misspelled method
This commit is contained in:
zzz
2015-04-23 10:28:02 +00:00
parent cbe91e3012
commit 6f0ebb2d94
5 changed files with 8 additions and 7 deletions

View File

@@ -89,7 +89,7 @@ class Connection {
private final AtomicLong _lifetimeDupMessageReceived = new AtomicLong(); private final AtomicLong _lifetimeDupMessageReceived = new AtomicLong();
public static final long MAX_RESEND_DELAY = 45*1000; 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. * Wait up to 5 minutes after disconnection so we can ack/close packets.

View File

@@ -129,7 +129,8 @@ class ConnectionOptions extends I2PSocketOptionsImpl {
static final int INITIAL_WINDOW_SIZE = 6; static final int INITIAL_WINDOW_SIZE = 6;
static final int DEFAULT_MAX_SENDS = 8; static final int DEFAULT_MAX_SENDS = 8;
public static final int DEFAULT_INITIAL_RTT = 8*1000; 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; static final int MIN_WINDOW_SIZE = 1;
private static final boolean DEFAULT_ANSWER_PINGS = true; private static final boolean DEFAULT_ANSWER_PINGS = true;
private static final int DEFAULT_INACTIVITY_TIMEOUT = 90*1000; private static final int DEFAULT_INACTIVITY_TIMEOUT = 90*1000;
@@ -559,8 +560,8 @@ class ConnectionOptions extends I2PSocketOptionsImpl {
synchronized(this) { synchronized(this) {
_rtt = ms; _rtt = ms;
if (_rtt > 60*1000) if (_rtt > MAX_RTT)
_rtt = 60*1000; _rtt = MAX_RTT;
} }
} }

View File

@@ -107,7 +107,7 @@ class ConnectionPacketHandler {
// Here, for the purposes of calculating whether the input stream is full, // Here, for the purposes of calculating whether the input stream is full,
// we assume all the not-ready blocks are the max message size. // 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 // 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 available = con.getOptions().getInboundBufferSize() - con.getInputStream().getTotalReadySize();
int allowedBlocks = available/con.getOptions().getMaxMessageSize(); int allowedBlocks = available/con.getOptions().getMaxMessageSize();
if (seqNum > ready + allowedBlocks) { if (seqNum > ready + allowedBlocks) {

View File

@@ -74,7 +74,7 @@ class MessageInputStream extends InputStream {
/** What is the highest block ID we've completely received through? /** What is the highest block ID we've completely received through?
* @return highest data block ID completely received or -1 for none * @return highest data block ID completely received or -1 for none
*/ */
public long getHighestReadyBockId() { public long getHighestReadyBlockId() {
synchronized (_dataLock) { synchronized (_dataLock) {
return _highestReadyBlockId; return _highestReadyBlockId;
} }

View File

@@ -272,7 +272,7 @@ public class PcapWriter {
// TODO just use a recent high unackedIn count? // TODO just use a recent high unackedIn count?
// following is from ConnectionPacketHandler // following is from ConnectionPacketHandler
// this is not interesting, we have lots of buffers // 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 available = con.getOptions().getInboundBufferSize() - con.getInputStream().getTotalReadySize();
int allowedBlocks = available/con.getOptions().getMaxMessageSize(); int allowedBlocks = available/con.getOptions().getMaxMessageSize();
window = (ready + allowedBlocks) - pkt.getSequenceNum(); window = (ready + allowedBlocks) - pkt.getSequenceNum();