diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java index feee19258..74c6f0a95 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/I2PTunnelHTTPServer.java @@ -46,6 +46,8 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer { private static final String SERVER_HEADER = "Server"; private static final String[] SERVER_SKIPHEADERS = {SERVER_HEADER}; 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 = ("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 }); } + @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 * @@ -168,8 +178,10 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer { try { socket.close(); } catch (IOException ioe) {} - if (_log.shouldLog(Log.ERROR)) - _log.error("Error connecting to HTTP server " + remoteHost + ':' + remotePort, ex); + // Don't complain too early, Jetty may not be ready. + 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) { try { socket.close(); diff --git a/history.txt b/history.txt index 0f149f742..0c0e00c50 100644 --- a/history.txt +++ b/history.txt @@ -1,3 +1,6 @@ +2011-12-11 sponge + * HTTP server tunnel, use log.WARN for 3 first minutes. (closes #460) + 2011-12-10 kytv * Replace eepget's whitelist of accepted characters with the blacklist from i2psnark. (closes #562)