forked from I2P_Developers/i2p.i2p
2005-02-20 jrandom
* Allow the streaming lib resend frequency to drop down to 20s as the minimum, so that up to 2 retries can get sent on an http request. * Add further limits to failsafe tunnels. * Keep exploratory and client tunnel testing and building stats separate. * Only use the 60s period for throttling tunnel requests due to transient network overload. * Rebuild tunnels earlier (1-3m before expiration, by default) * Cache the next hop's routerInfo for participating tunnels so that the tunnel participation doesn't depend on the netDb. * Fixed a long standing bug in the streaming lib where we wouldn't always unchoke messages when the window size grows. * Make sure the window size never reaches 0 (duh)
This commit is contained in:
@@ -216,7 +216,7 @@ public class I2PTunnelRunner extends I2PThread implements I2PSocket.SocketErrorL
|
||||
this.out = out;
|
||||
_toI2P = toI2P;
|
||||
direction = (toI2P ? "toI2P" : "fromI2P");
|
||||
_cache = ByteCache.getInstance(256, NETWORK_BUFFER_SIZE);
|
||||
_cache = ByteCache.getInstance(16, NETWORK_BUFFER_SIZE);
|
||||
setName("StreamForwarder " + _runnerId + "." + (++__forwarderId));
|
||||
start();
|
||||
}
|
||||
|
@@ -49,9 +49,11 @@ public class ConfigTunnelsHelper {
|
||||
TunnelPoolSettings in = _context.tunnelManager().getInboundSettings(dest.calculateHash());
|
||||
TunnelPoolSettings out = _context.tunnelManager().getOutboundSettings(dest.calculateHash());
|
||||
|
||||
String name = (in != null ? in.getDestinationNickname() : null);
|
||||
if ( (in == null) || (out == null) ) continue;
|
||||
|
||||
String name = in.getDestinationNickname();
|
||||
if (name == null)
|
||||
name = (out != null ? out.getDestinationNickname() : null);
|
||||
name = out.getDestinationNickname();
|
||||
if (name == null)
|
||||
name = dest.calculateHash().toBase64().substring(0,6);
|
||||
|
||||
|
@@ -76,7 +76,7 @@ public class Connection {
|
||||
private long _lifetimeDupMessageReceived;
|
||||
|
||||
public static final long MAX_RESEND_DELAY = 60*1000;
|
||||
public static final long MIN_RESEND_DELAY = 30*1000;
|
||||
public static final long MIN_RESEND_DELAY = 20*1000;
|
||||
|
||||
/** wait up to 5 minutes after disconnection so we can ack/close packets */
|
||||
public static int DISCONNECT_TIMEOUT = 5*60*1000;
|
||||
@@ -181,6 +181,11 @@ public class Connection {
|
||||
}
|
||||
}
|
||||
}
|
||||
void windowAdjusted() {
|
||||
synchronized (_outboundPackets) {
|
||||
_outboundPackets.notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
void ackImmediately() {
|
||||
_receiver.send(null, 0, 0);
|
||||
@@ -866,6 +871,7 @@ public class Connection {
|
||||
+ ") for " + Connection.this.toString());
|
||||
|
||||
getOptions().setWindowSize(newWindowSize);
|
||||
windowAdjusted();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -160,6 +160,8 @@ public class ConnectionOptions extends I2PSocketOptionsImpl {
|
||||
public void setWindowSize(int numMsgs) {
|
||||
if (numMsgs > _maxWindowSize)
|
||||
numMsgs = _maxWindowSize;
|
||||
else if (numMsgs <= 0)
|
||||
numMsgs = 1;
|
||||
_windowSize = numMsgs;
|
||||
}
|
||||
|
||||
|
@@ -224,6 +224,9 @@ public class ConnectionPacketHandler {
|
||||
newWindowSize += 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (newWindowSize <= 0)
|
||||
newWindowSize = 1;
|
||||
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("New window size " + newWindowSize + "/" + oldWindow + " congestionSeenAt: "
|
||||
@@ -233,6 +236,7 @@ public class ConnectionPacketHandler {
|
||||
con.setCongestionWindowEnd(newWindowSize + lowest);
|
||||
}
|
||||
|
||||
con.windowAdjusted();
|
||||
return congested;
|
||||
}
|
||||
|
||||
|
@@ -38,7 +38,7 @@ class SchedulerConnectedBulk extends SchedulerImpl {
|
||||
|
||||
public boolean accept(Connection con) {
|
||||
boolean ok = (con != null) &&
|
||||
(con.getAckedPackets() > 0) &&
|
||||
(con.getHighestAckedThrough() >= 0) &&
|
||||
(con.getOptions().getProfile() == ConnectionOptions.PROFILE_BULK) &&
|
||||
(!con.getResetReceived()) &&
|
||||
( (con.getCloseSentOn() <= 0) || (con.getCloseReceivedOn() <= 0) );
|
||||
|
@@ -39,7 +39,7 @@ class SchedulerConnecting extends SchedulerImpl {
|
||||
boolean notYetConnected = (con.getIsConnected()) &&
|
||||
//(con.getSendStreamId() == null) && // not null on recv
|
||||
(con.getLastSendId() >= 0) &&
|
||||
(con.getAckedPackets() <= 0) &&
|
||||
(con.getHighestAckedThrough() < 0) &&
|
||||
(!con.getResetReceived());
|
||||
return notYetConnected;
|
||||
}
|
||||
|
Reference in New Issue
Block a user