forked from I2P_Developers/i2p.i2p
i2ptunnel: Change read timeout defaults now that streaming read timeout works
This commit is contained in:
@ -32,7 +32,8 @@ public class I2PTunnelClient extends I2PTunnelClientBase {
|
||||
* replacement for dests
|
||||
*/
|
||||
private final List<I2PSocketAddress> _addrs;
|
||||
private static final long DEFAULT_READ_TIMEOUT = 5*60*1000; // -1
|
||||
// We don't know what protocol, so we assume the application has its own timeout mechanism
|
||||
private static final long DEFAULT_READ_TIMEOUT = -1;
|
||||
protected long readTimeout = DEFAULT_READ_TIMEOUT;
|
||||
private InternalSocketRunner _isr;
|
||||
|
||||
@ -107,7 +108,36 @@ public class I2PTunnelClient extends I2PTunnelClientBase {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the read idle timeout for newly-created connections (in
|
||||
* milliseconds). After this time expires without data being reached from
|
||||
* the I2P network, the connection itself will be closed.
|
||||
*
|
||||
* Less than or equal to 0 means forever.
|
||||
* Default -1 (forever) as of 0.9.36 for standard tunnels,
|
||||
* but extending classes may override.
|
||||
* Prior to that, default was 5 minutes, but did not work
|
||||
* due to streaming bugs.
|
||||
*
|
||||
* Applies only to future connections;
|
||||
* calling this does not affect existing connections.
|
||||
*
|
||||
* @param ms in ms
|
||||
*/
|
||||
public void setReadTimeout(long ms) { readTimeout = ms; }
|
||||
|
||||
/**
|
||||
* Get the read idle timeout for newly-created connections (in
|
||||
* milliseconds).
|
||||
*
|
||||
* Less than or equal to 0 means forever.
|
||||
* Default -1 (forever) as of 0.9.36 for standard tunnels,
|
||||
* but extending classes may override.
|
||||
* Prior to that, default was 5 minutes, but did not work
|
||||
* due to streaming bugs.
|
||||
*
|
||||
* @return in ms
|
||||
*/
|
||||
public long getReadTimeout() { return readTimeout; }
|
||||
|
||||
protected void clientConnectionRun(Socket s) {
|
||||
|
@ -137,7 +137,11 @@ public abstract class I2PTunnelHTTPClientBase extends I2PTunnelClientBase implem
|
||||
}
|
||||
}
|
||||
|
||||
protected static final int DEFAULT_READ_TIMEOUT = 5*60*1000;
|
||||
/**
|
||||
* -1 (forever) as of 0.9.36,
|
||||
* so that large POSTs won't timeout on the read side
|
||||
*/
|
||||
protected static final int DEFAULT_READ_TIMEOUT = -1;
|
||||
|
||||
protected static final AtomicLong __requestId = new AtomicLong();
|
||||
|
||||
|
@ -88,6 +88,10 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
|
||||
private static final int MAX_HEADERS = 60;
|
||||
/** Includes request, just to prevent OOM DOS @since 0.9.20 */
|
||||
private static final int MAX_TOTAL_HEADER_SIZE = 32*1024;
|
||||
// Does not apply to header reads.
|
||||
// We set it to forever so that it won't timeout when sending a large response.
|
||||
// The server will presumably have its own timeout implemented for POST
|
||||
private static final long DEFAULT_HTTP_READ_TIMEOUT = -1;
|
||||
|
||||
private long _startedOn = 0L;
|
||||
private ConnThrottler _postThrottler;
|
||||
@ -205,6 +209,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
|
||||
private void setupI2PTunnelHTTPServer(String spoofHost) {
|
||||
_spoofHost = (spoofHost != null && spoofHost.trim().length() > 0) ? spoofHost.trim() : null;
|
||||
getTunnel().getContext().statManager().createRateStat("i2ptunnel.httpserver.blockingHandleTime", "how long the blocking handle takes to complete", "I2PTunnel.HTTPServer", new long[] { 60*1000, 10*60*1000, 3*60*60*1000 });
|
||||
readTimeout = DEFAULT_HTTP_READ_TIMEOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -30,7 +30,8 @@ public class I2PTunnelIRCClient extends I2PTunnelClientBase {
|
||||
|
||||
/** list of Destination objects that we point at */
|
||||
private final List<I2PSocketAddress> _addrs;
|
||||
private static final long DEFAULT_READ_TIMEOUT = 5*60*1000; // -1
|
||||
// application should ping timeout before this
|
||||
private static final long DEFAULT_READ_TIMEOUT = 10*60*1000;
|
||||
protected long readTimeout = DEFAULT_READ_TIMEOUT;
|
||||
private final boolean _dccEnabled;
|
||||
private I2PTunnelDCCServer _DCCServer;
|
||||
|
@ -73,6 +73,8 @@ public class I2PTunnelIRCServer extends I2PTunnelServer implements Runnable {
|
||||
private static final long HEADER_TIMEOUT = 15*1000;
|
||||
private static final long TOTAL_HEADER_TIMEOUT = 2 * HEADER_TIMEOUT;
|
||||
private static final int MAX_LINE_LENGTH = 1024;
|
||||
// application should ping timeout before this
|
||||
private static final long DEFAULT_IRC_READ_TIMEOUT = 10*60*1000;
|
||||
|
||||
private final static String ERR_UNAVAILABLE =
|
||||
":ircserver.i2p 499 you :" +
|
||||
@ -134,6 +136,7 @@ public class I2PTunnelIRCServer extends I2PTunnelServer implements Runnable {
|
||||
|
||||
// get the fake hostmask to use
|
||||
this.hostname = opts.getProperty(PROP_HOSTNAME, PROP_HOSTNAME_DEFAULT);
|
||||
readTimeout = DEFAULT_IRC_READ_TIMEOUT;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,8 +62,8 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
protected final Logging l;
|
||||
private I2PSSLSocketFactory _sslFactory;
|
||||
|
||||
private static final long DEFAULT_READ_TIMEOUT = 5*60*1000;
|
||||
/** default timeout to 5 minutes - override if desired */
|
||||
private static final long DEFAULT_READ_TIMEOUT = -1;
|
||||
/** default timeout - override if desired */
|
||||
protected long readTimeout = DEFAULT_READ_TIMEOUT;
|
||||
|
||||
/** do we use threads? default true (ignored for standard servers, always false) */
|
||||
@ -371,6 +371,17 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
* Set the read idle timeout for newly-created connections (in
|
||||
* milliseconds). After this time expires without data being reached from
|
||||
* the I2P network, the connection itself will be closed.
|
||||
*
|
||||
* Less than or equal to 0 means forever.
|
||||
* Default -1 (forever) as of 0.9.36 for standard tunnels,
|
||||
* but extending classes may override.
|
||||
* Prior to that, default was 5 minutes, but did not work
|
||||
* due to streaming bugs.
|
||||
*
|
||||
* Applies only to future connections;
|
||||
* calling this does not affect existing connections.
|
||||
*
|
||||
* @param ms in ms
|
||||
*/
|
||||
public void setReadTimeout(long ms) {
|
||||
readTimeout = ms;
|
||||
@ -380,6 +391,12 @@ public class I2PTunnelServer extends I2PTunnelTask implements Runnable {
|
||||
* Get the read idle timeout for newly-created connections (in
|
||||
* milliseconds).
|
||||
*
|
||||
* Less than or equal to 0 means forever.
|
||||
* Default -1 (forever) as of 0.9.36 for standard tunnels,
|
||||
* but extending classes may override.
|
||||
* Prior to that, default was 5 minutes, but did not work
|
||||
* due to streaming bugs.
|
||||
*
|
||||
* @return The read timeout used for connections
|
||||
*/
|
||||
public long getReadTimeout() {
|
||||
|
@ -64,6 +64,8 @@ public class I2PTunnelDCCServer extends I2PTunnelServer {
|
||||
private static final int MAX_OUTGOING_PENDING = 20;
|
||||
private static final int MAX_OUTGOING_ACTIVE = 20;
|
||||
private static final long OUTBOUND_EXPIRE = 30*60*1000;
|
||||
private static final long DEFAULT_DCC_READ_TIMEOUT = -1;
|
||||
|
||||
/**
|
||||
* There's no support for unsolicited incoming I2P connections,
|
||||
* so there's no server host or port parameters.
|
||||
@ -79,6 +81,7 @@ public class I2PTunnelDCCServer extends I2PTunnelServer {
|
||||
_active = new ConcurrentHashMap<Integer, LocalAddress>(8);
|
||||
_resume = new ConcurrentHashMap<Integer, LocalAddress>(8);
|
||||
_sockList = new CopyOnWriteArrayList<I2PSocket>();
|
||||
readTimeout = DEFAULT_DCC_READ_TIMEOUT;
|
||||
}
|
||||
|
||||
/**
|
||||
|
13
history.txt
13
history.txt
@ -1,3 +1,16 @@
|
||||
2018-08-16 zzz
|
||||
* i2ptunnel: Change read timeout defaults now that streaming timeout works
|
||||
|
||||
2018-08-13 zzz
|
||||
* Console: Format part. tunnel rate
|
||||
|
||||
2018-08-04 zzz
|
||||
* Data: Check sooner for unknown sig type
|
||||
* I2NP: Remove unused Stream methods
|
||||
|
||||
2018-08-03 zzz
|
||||
* NTCP2: Fix termination handling and padding calculation
|
||||
|
||||
2018-08-02 zzz
|
||||
* i2psnark: Don't disconnect seeds if comments enabled (ticket #2288)
|
||||
* NTCP2: Send termination on idle timeout
|
||||
|
@ -18,7 +18,7 @@ public class RouterVersion {
|
||||
/** deprecated */
|
||||
public final static String ID = "Monotone";
|
||||
public final static String VERSION = CoreVersion.VERSION;
|
||||
public final static long BUILD = 23;
|
||||
public final static long BUILD = 24;
|
||||
|
||||
/** for example "-test" */
|
||||
public final static String EXTRA = "-rc";
|
||||
|
Reference in New Issue
Block a user