forked from I2P_Developers/i2p.i2p
HTTP server tunnel, use log.WARN for 3 first minutes. (closes #460)
This commit is contained in:
@@ -46,6 +46,8 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
|
|||||||
private static final String SERVER_HEADER = "Server";
|
private static final String SERVER_HEADER = "Server";
|
||||||
private static final String[] SERVER_SKIPHEADERS = {SERVER_HEADER};
|
private static final String[] SERVER_SKIPHEADERS = {SERVER_HEADER};
|
||||||
private static final long HEADER_TIMEOUT = 60*1000;
|
private static final long HEADER_TIMEOUT = 60*1000;
|
||||||
|
private static final long START_INTERVAL = (60 * 1000) * 3;
|
||||||
|
private long _startedOn = 0L;
|
||||||
|
|
||||||
private final static byte[] ERR_UNAVAILABLE =
|
private final static byte[] ERR_UNAVAILABLE =
|
||||||
("HTTP/1.1 503 Service Unavailable\r\n"+
|
("HTTP/1.1 503 Service Unavailable\r\n"+
|
||||||
@@ -81,6 +83,14 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
|
|||||||
getTunnel().getContext().statManager().createRateStat("i2ptunnel.httpNullWorkaround", "How often an http server works around a streaming lib or i2ptunnel bug", "I2PTunnel.HTTPServer", new long[] { 60*1000, 10*60*1000 });
|
getTunnel().getContext().statManager().createRateStat("i2ptunnel.httpNullWorkaround", "How often an http server works around a streaming lib or i2ptunnel bug", "I2PTunnel.HTTPServer", new long[] { 60*1000, 10*60*1000 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void startRunning() {
|
||||||
|
super.startRunning();
|
||||||
|
_startedOn = getTunnel().getContext().clock().now();
|
||||||
|
// Would be better if this was set when the inbound tunnel becomes alive.
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called by the thread pool of I2PSocket handlers
|
* Called by the thread pool of I2PSocket handlers
|
||||||
*
|
*
|
||||||
@@ -168,8 +178,10 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
|
|||||||
try {
|
try {
|
||||||
socket.close();
|
socket.close();
|
||||||
} catch (IOException ioe) {}
|
} catch (IOException ioe) {}
|
||||||
if (_log.shouldLog(Log.ERROR))
|
// Don't complain too early, Jetty may not be ready.
|
||||||
_log.error("Error connecting to HTTP server " + remoteHost + ':' + remotePort, ex);
|
int level = getTunnel().getContext().clock().now() - _startedOn > START_INTERVAL ? Log.ERROR : Log.WARN;
|
||||||
|
if (_log.shouldLog(level))
|
||||||
|
_log.log(level, "Error connecting to HTTP server " + remoteHost + ':' + remotePort, ex);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
try {
|
try {
|
||||||
socket.close();
|
socket.close();
|
||||||
|
@@ -1,3 +1,6 @@
|
|||||||
|
2011-12-11 sponge
|
||||||
|
* HTTP server tunnel, use log.WARN for 3 first minutes. (closes #460)
|
||||||
|
|
||||||
2011-12-10 kytv
|
2011-12-10 kytv
|
||||||
* Replace eepget's whitelist of accepted characters with the
|
* Replace eepget's whitelist of accepted characters with the
|
||||||
blacklist from i2psnark. (closes #562)
|
blacklist from i2psnark. (closes #562)
|
||||||
|
Reference in New Issue
Block a user