* i2ptunnel:

- Set default read timeout in standard server
   - Reduce header timeout, enforce total header timeout
     in IRC and HTTP servers (ticket #723)
 * Streaming: Don't ignore option or force connect timeout to 5 minutes
 * Streaming javadocs
 * SocketTimeout cleanup
This commit is contained in:
zzz
2012-10-07 20:57:35 +00:00
parent 6b97e1bfaf
commit b095b7e769
11 changed files with 101 additions and 23 deletions

View File

@ -87,7 +87,7 @@ class Connection {
/** wait up to 5 minutes after disconnection so we can ack/close packets */
public static final int DISCONNECT_TIMEOUT = 5*60*1000;
private static final long DEFAULT_CONNECT_TIMEOUT = 60*1000;
public static final int DEFAULT_CONNECT_TIMEOUT = 60*1000;
private static final long MAX_CONNECT_TIMEOUT = 2*60*1000;
public static final int MAX_WINDOW_SIZE = 128;
@ -549,7 +549,15 @@ class Connection {
public void setInbound() { _isInbound = true; }
public boolean isInbound() { return _isInbound; }
/**
* Always true at the start, even if we haven't gotten a reply on an
* outbound connection. Only set to false on disconnect.
* For outbound, use getHighestAckedThrough() >= 0 also,
* to determine if the connection is up.
*/
public boolean getIsConnected() { return _connected; }
public boolean getHardDisconnected() { return _hardDisconnected; }
public boolean getResetSent() { return _resetSent; }
public long getResetSentOn() { return _resetSentOn; }
@ -1017,7 +1025,7 @@ class Connection {
@Override
public String toString() {
StringBuilder buf = new StringBuilder(128);
StringBuilder buf = new StringBuilder(256);
buf.append("[Connection ");
if (_receiveStreamId > 0)
buf.append(Packet.toId(_receiveStreamId));
@ -1075,6 +1083,7 @@ class Connection {
buf.append(" close received ").append(DataHelper.formatDuration(_context.clock().now() - getCloseReceivedOn())).append(" ago");
buf.append(" sent: ").append(1 + _lastSendId.get());
buf.append(" rcvd: ").append(1 + _inputStream.getHighestBlockId() - missing);
buf.append(" ackThru ").append(_highestAckedThrough);
buf.append(" maxWin ").append(getOptions().getMaxWindowSize());
buf.append(" MTU ").append(getOptions().getMaxMessageSize());

View File

@ -343,8 +343,8 @@ class ConnectionOptions extends I2PSocketOptionsImpl {
DEFAULT_CONGESTION_AVOIDANCE_GROWTH_RATE_FACTOR));
setSlowStartGrowthRateFactor(getInt(opts, PROP_SLOW_START_GROWTH_RATE_FACTOR,
DEFAULT_SLOW_START_GROWTH_RATE_FACTOR));
// overrides default in super()
setConnectTimeout(getInt(opts, PROP_CONNECT_TIMEOUT, Connection.DISCONNECT_TIMEOUT));
// overrides default in super()... why?
//setConnectTimeout(getInt(opts, PROP_CONNECT_TIMEOUT, Connection.DISCONNECT_TIMEOUT));
setAnswerPings(getBool(opts, PROP_ANSWER_PINGS, DEFAULT_ANSWER_PINGS));
setEnforceProtocol(getBool(opts, PROP_ENFORCE_PROTO, DEFAULT_ENFORCE_PROTO));
initLists(opts);
@ -399,9 +399,8 @@ class ConnectionOptions extends I2PSocketOptionsImpl {
setSlowStartGrowthRateFactor(getInt(opts, PROP_SLOW_START_GROWTH_RATE_FACTOR,
DEFAULT_SLOW_START_GROWTH_RATE_FACTOR));
if (opts.containsKey(PROP_CONNECT_TIMEOUT))
// wow 5 minutes!!! FIXME!!
// overrides default in super()
setConnectTimeout(getInt(opts, PROP_CONNECT_TIMEOUT, Connection.DISCONNECT_TIMEOUT));
setConnectTimeout(getInt(opts, PROP_CONNECT_TIMEOUT, Connection.DEFAULT_CONNECT_TIMEOUT));
if (opts.containsKey(PROP_ANSWER_PINGS))
setAnswerPings(getBool(opts, PROP_ANSWER_PINGS, DEFAULT_ANSWER_PINGS));
if (opts.containsKey(PROP_ENFORCE_PROTO))

View File

@ -29,7 +29,7 @@ class SchedulerChooser {
TaskScheduler scheduler = _schedulers.get(i);
if (scheduler.accept(con)) {
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("Scheduling for " + con + " with " + scheduler.getClass().getName());
// _log.debug("Scheduling for " + con + " with " + scheduler.getClass().getSimpleName());
return scheduler;
}
}