Class Http3StreamWriteStallHandler

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelOutboundHandlerAdapter
org.mockserver.netty.http3.Http3StreamWriteStallHandler
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelOutboundHandler

public final class Http3StreamWriteStallHandler extends io.netty.channel.ChannelOutboundHandlerAdapter
Resets an HTTP/3 request stream (RESET_STREAM H3_INTERNAL_ERROR) when writes have been waiting on it for responseWriteStallTimeoutMillis and QUIC has taken none of them, so a client that stops reading a response cannot hold it, or a streamed response's upstream, indefinitely.

QUIC completes a write only once it has taken all of it, and reports nothing of a part. So every write, whichever handler made it, is passed on in parts of at most MAX_WRITE_BYTES, and a slow reader of one large frame shows progress; the bytes on the wire are unchanged. QUIC can complete an earlier write while it is given a later one, so a write made from a listener of that completion is held until the write being passed on has been, whole. Installed first in each request stream's pipeline, below the HTTP/3 frame codec. A connection's streams are timed together by its Http3ConnectionWriteStallWatcher, with the timeout its first stream was given.

  • Nested Class Summary

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Constructor Summary

    Constructors
    Constructor
    Description
    Http3StreamWriteStallHandler(long timeoutMillis, org.mockserver.logging.MockServerLogger mockServerLogger)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    flush(io.netty.channel.ChannelHandlerContext ctx)
     
    void
    handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
     
    void
    handlerRemoved(io.netty.channel.ChannelHandlerContext ctx)
     
    void
    write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise)
     

    Methods inherited from class io.netty.channel.ChannelOutboundHandlerAdapter

    bind, close, connect, deregister, disconnect, read

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, exceptionCaught, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.netty.channel.ChannelHandler

    exceptionCaught
  • Constructor Details

    • Http3StreamWriteStallHandler

      public Http3StreamWriteStallHandler(long timeoutMillis, org.mockserver.logging.MockServerLogger mockServerLogger)
  • Method Details

    • handlerAdded

      public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
      Specified by:
      handlerAdded in interface io.netty.channel.ChannelHandler
      Overrides:
      handlerAdded in class io.netty.channel.ChannelHandlerAdapter
    • handlerRemoved

      public void handlerRemoved(io.netty.channel.ChannelHandlerContext ctx)
      Specified by:
      handlerRemoved in interface io.netty.channel.ChannelHandler
      Overrides:
      handlerRemoved in class io.netty.channel.ChannelHandlerAdapter
    • write

      public void write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise)
      Specified by:
      write in interface io.netty.channel.ChannelOutboundHandler
      Overrides:
      write in class io.netty.channel.ChannelOutboundHandlerAdapter
    • flush

      public void flush(io.netty.channel.ChannelHandlerContext ctx)
      Specified by:
      flush in interface io.netty.channel.ChannelOutboundHandler
      Overrides:
      flush in class io.netty.channel.ChannelOutboundHandlerAdapter