Issue #6728 - QUIC and HTTP/3
- Fixed idle timeout handling. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
cb97549fa6
commit
4c22ae9e1b
|
@ -64,6 +64,12 @@ public class HttpChannelOverHTTP3 extends HttpChannel
|
|||
return (HttpTransportOverHTTP3)super.getHttpTransport();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIdleTimeout(long timeoutMs)
|
||||
{
|
||||
stream.setIdleTimeout(timeoutMs);
|
||||
}
|
||||
|
||||
void consumeInput()
|
||||
{
|
||||
getRequest().getHttpInput().consumeAll();
|
||||
|
@ -226,36 +232,44 @@ public class HttpChannelOverHTTP3 extends HttpChannel
|
|||
|
||||
public boolean onIdleTimeout(Throwable failure, Consumer<Runnable> consumer)
|
||||
{
|
||||
try (AutoLock l = lock.lock())
|
||||
{
|
||||
if (content == null)
|
||||
content = new HttpInput.ErrorContent(failure);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean wasDelayed = delayedUntilContent;
|
||||
delayedUntilContent = false;
|
||||
|
||||
if (wasDelayed)
|
||||
connection.setApplicationMode(true);
|
||||
|
||||
boolean reset = getState().isIdle();
|
||||
if (reset)
|
||||
consumeInput();
|
||||
|
||||
getHttpTransport().onIdleTimeout(failure);
|
||||
|
||||
failure.addSuppressed(new Throwable("idle timeout"));
|
||||
boolean neverDispatched = getState().isIdle();
|
||||
boolean hasDemand = stream.hasDemand();
|
||||
|
||||
boolean needed = getRequest().getHttpInput().onContentProducible();
|
||||
if (needed || wasDelayed)
|
||||
if (LOG.isDebugEnabled())
|
||||
{
|
||||
consumer.accept(this::handleWithContext);
|
||||
reset = false;
|
||||
LOG.debug("HTTP3 request idle timeout #{}/{}, dispatched={} demand={}",
|
||||
stream.getId(),
|
||||
Integer.toHexString(stream.getSession().hashCode()),
|
||||
!neverDispatched,
|
||||
hasDemand);
|
||||
}
|
||||
|
||||
return reset;
|
||||
if (neverDispatched)
|
||||
{
|
||||
try (AutoLock l = lock.lock())
|
||||
{
|
||||
content = new HttpInput.ErrorContent(failure);
|
||||
}
|
||||
consumer.accept(this::handleWithContext);
|
||||
}
|
||||
else if (hasDemand)
|
||||
{
|
||||
try (AutoLock l = lock.lock())
|
||||
{
|
||||
content = new HttpInput.ErrorContent(failure);
|
||||
}
|
||||
if (getRequest().getHttpInput().onContentProducible())
|
||||
consumer.accept(this::handleWithContext);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void handleWithContext()
|
||||
|
|
|
@ -52,6 +52,8 @@ import org.junit.jupiter.params.ParameterizedTest;
|
|||
import org.junit.jupiter.params.provider.ArgumentsSource;
|
||||
|
||||
import static org.eclipse.jetty.http.client.Transport.FCGI;
|
||||
import static org.eclipse.jetty.http.client.Transport.H2;
|
||||
import static org.eclipse.jetty.http.client.Transport.H2C;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
|
@ -599,7 +601,7 @@ public class ServerTimeoutsTest extends AbstractTest<TransportScenario>
|
|||
// In HTTP/2, we force the flow control window to be small, so that the server
|
||||
// stalls almost immediately without having written many bytes, so that the test
|
||||
// completes quickly.
|
||||
Assumptions.assumeTrue(transport.isMultiplexed());
|
||||
Assumptions.assumeTrue(transport == H2C || transport == H2);
|
||||
|
||||
init(transport);
|
||||
|
||||
|
|
Loading…
Reference in New Issue