Fixes #4258 - RateControl should be per-connection.
Updates after review. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
f8449868e6
commit
f675a87623
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
/**
|
||||
* <p>An implementation of {@link RateControl} that limits the number of
|
||||
* events within a time period.</p>
|
||||
|
@ -78,7 +80,7 @@ public class WindowRateControl implements RateControl
|
|||
}
|
||||
|
||||
@Override
|
||||
public RateControl newRateControl()
|
||||
public RateControl newRateControl(EndPoint endPoint)
|
||||
{
|
||||
return WindowRateControl.fromEventsPerSecond(maxEventRate);
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
Loading…
Reference in New Issue