diff --git a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/parser/RateControl.java b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/parser/RateControl.java index 76952e0152d..78970f45f44 100644 --- a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/parser/RateControl.java +++ b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/parser/RateControl.java @@ -18,6 +18,8 @@ package org.eclipse.jetty.http2.parser; +import org.eclipse.jetty.io.EndPoint; + /** * Controls rate of events via {@link #onEvent(Object)}. */ @@ -43,9 +45,10 @@ public interface RateControl public interface Factory { /** - * @return a new RateControl instance. + * @return a new RateControl instance for the given EndPoint + * @param endPoint the EndPoint for which the RateControl is created */ - public default RateControl newRateControl() + public default RateControl newRateControl(EndPoint endPoint) { return NO_RATE_CONTROL; } diff --git a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/parser/WindowRateControl.java b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/parser/WindowRateControl.java index fd1e83942ac..b421e9f887d 100644 --- a/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/parser/WindowRateControl.java +++ b/jetty-http2/http2-common/src/main/java/org/eclipse/jetty/http2/parser/WindowRateControl.java @@ -23,6 +23,8 @@ import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.atomic.AtomicInteger; +import org.eclipse.jetty.io.EndPoint; + /** *

An implementation of {@link RateControl} that limits the number of * events within a time period.

@@ -78,7 +80,7 @@ public class WindowRateControl implements RateControl } @Override - public RateControl newRateControl() + public RateControl newRateControl(EndPoint endPoint) { return WindowRateControl.fromEventsPerSecond(maxEventRate); } diff --git a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java index f6b7dc70c90..b6d41d78c0a 100644 --- a/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java +++ b/jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/AbstractHTTP2ServerConnectionFactory.java @@ -279,7 +279,7 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne session.setInitialSessionRecvWindow(getInitialSessionRecvWindow()); session.setWriteThreshold(getHttpConfiguration().getOutputBufferSize()); - ServerParser parser = newServerParser(connector, session, getRateControlFactory().newRateControl()); + ServerParser parser = newServerParser(connector, session, getRateControlFactory().newRateControl(endPoint)); parser.setMaxFrameLength(getMaxFrameLength()); parser.setMaxSettingsKeys(getMaxSettingsKeys());