Streaming: configurable response when over connection limits (ticket #2145)

Drop when way over limits.
Default to HTTP 429 for HTTP Server tunnels
Increase recently-closed cache size
This commit is contained in:
zzz
2018-02-16 19:49:49 +00:00
parent a1ed4cf3b0
commit cabf1aa3c5
6 changed files with 138 additions and 29 deletions

View File

@@ -105,6 +105,9 @@ public class TunnelController implements Logging {
public static final int DEFAULT_MAX_TOTAL_CONNS_DAY = 0;
public static final int DEFAULT_MAX_STREAMS = 20;
/** @since 0.9.34 */
public static final String PROP_LIMIT_ACTION = "i2p.streaming.limitAction";
/** @since 0.9.14 */
public static final String PFX_OPTION = "option.";
@@ -130,6 +133,9 @@ public class TunnelController implements Logging {
public static final String OPT_POST_MAX = PFX_OPTION + I2PTunnelHTTPServer.OPT_POST_MAX;
public static final String OPT_POST_TOTAL_MAX = PFX_OPTION + I2PTunnelHTTPServer.OPT_POST_TOTAL_MAX;
/** @since 0.9.34 */
private static final String OPT_LIMIT_ACTION = PFX_OPTION + PROP_LIMIT_ACTION;
/** all of these @since 0.9.14 */
public static final String TYPE_CONNECT = "connectclient";
public static final String TYPE_HTTP_BIDIR_SERVER = "httpbidirserver";
@@ -800,6 +806,10 @@ public class TunnelController implements Logging {
// is done in the I2PTunnelServer constructor.
String type = getType();
if (type != null) {
if (type.equals(TYPE_HTTP_SERVER)) {
if (!_config.containsKey(OPT_LIMIT_ACTION))
_config.setProperty(OPT_LIMIT_ACTION, "http");
}
if (type.equals(TYPE_HTTP_SERVER) || type.equals(TYPE_STREAMR_SERVER)) {
if (!_config.containsKey(OPT_BUNDLE_REPLY))
_config.setProperty(OPT_BUNDLE_REPLY, "false");