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;
|
package org.eclipse.jetty.http2.parser;
|
||||||
|
|
||||||
|
import org.eclipse.jetty.io.EndPoint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controls rate of events via {@link #onEvent(Object)}.
|
* Controls rate of events via {@link #onEvent(Object)}.
|
||||||
*/
|
*/
|
||||||
|
@ -43,9 +45,10 @@ public interface RateControl
|
||||||
public interface Factory
|
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;
|
return NO_RATE_CONTROL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ import java.util.Queue;
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
import org.eclipse.jetty.io.EndPoint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>An implementation of {@link RateControl} that limits the number of
|
* <p>An implementation of {@link RateControl} that limits the number of
|
||||||
* events within a time period.</p>
|
* events within a time period.</p>
|
||||||
|
@ -78,7 +80,7 @@ public class WindowRateControl implements RateControl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RateControl newRateControl()
|
public RateControl newRateControl(EndPoint endPoint)
|
||||||
{
|
{
|
||||||
return WindowRateControl.fromEventsPerSecond(maxEventRate);
|
return WindowRateControl.fromEventsPerSecond(maxEventRate);
|
||||||
}
|
}
|
||||||
|
|
|
@ -279,7 +279,7 @@ public abstract class AbstractHTTP2ServerConnectionFactory extends AbstractConne
|
||||||
session.setInitialSessionRecvWindow(getInitialSessionRecvWindow());
|
session.setInitialSessionRecvWindow(getInitialSessionRecvWindow());
|
||||||
session.setWriteThreshold(getHttpConfiguration().getOutputBufferSize());
|
session.setWriteThreshold(getHttpConfiguration().getOutputBufferSize());
|
||||||
|
|
||||||
ServerParser parser = newServerParser(connector, session, getRateControlFactory().newRateControl());
|
ServerParser parser = newServerParser(connector, session, getRateControlFactory().newRateControl(endPoint));
|
||||||
parser.setMaxFrameLength(getMaxFrameLength());
|
parser.setMaxFrameLength(getMaxFrameLength());
|
||||||
parser.setMaxSettingsKeys(getMaxSettingsKeys());
|
parser.setMaxSettingsKeys(getMaxSettingsKeys());
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue