Class FrameLimitController

java.lang.Object
org.apache.hc.core5.http2.impl.nio.FrameLimitController

final class FrameLimitController extends Object
Per-connection resource policy for unsolicited HTTP/2 control frames. Non-ACK PING and SETTINGS frames share one token bucket, exactly as before this class existed; rapid cancellation (RST_STREAM) of peer-initiated streams is charged against its own, independent bucket.

ACK frames, DATA and WINDOW_UPDATE are not charged, as they can represent legitimate high-throughput or highly concurrent exchanges. A stream reset is only charged against the RST_STREAM bucket when it arrives shortly after the stream was activated; resets of long-lived streams are not charged.

Parameters are hardwired for now; they may become user configurable in the future, at which point this is the single place that would need a public constructor or setters.

This is a resource safeguard, not an RFC 9113 protocol-validity rule.

  • Field Details

  • Constructor Details

    • FrameLimitController

      FrameLimitController()
    • FrameLimitController

      FrameLimitController(int controlFrameCapacity, int controlFrameRefillPerSecond, int rstStreamCapacity, int rstStreamRefillPerSecond, long rstStreamMaxAgeNanos)
  • Method Details

    • acceptControlFrame

      boolean acceptControlFrame(long nowNanos)
    • acceptRapidReset

      boolean acceptRapidReset(long activatedAtNanos, long nowNanos)