Merge remote-tracking branch 'origin/jetty-11.0.x' into jetty-12.0.x
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
commit
ac2765c98d
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.http3.client.transport.internal;
|
package org.eclipse.jetty.http3.client.transport.internal;
|
||||||
|
|
||||||
|
import java.io.EOFException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
|
||||||
import org.eclipse.jetty.client.transport.HttpExchange;
|
import org.eclipse.jetty.client.transport.HttpExchange;
|
||||||
|
@ -46,9 +47,11 @@ public class HttpReceiverOverHTTP3 extends HttpReceiver implements Stream.Client
|
||||||
@Override
|
@Override
|
||||||
public Content.Chunk read(boolean fillInterestIfNeeded)
|
public Content.Chunk read(boolean fillInterestIfNeeded)
|
||||||
{
|
{
|
||||||
if (LOG.isDebugEnabled())
|
|
||||||
LOG.debug("Reading, fillInterestIfNeeded={} in {}", fillInterestIfNeeded, this);
|
|
||||||
Stream stream = getHttpChannel().getStream();
|
Stream stream = getHttpChannel().getStream();
|
||||||
|
if (LOG.isDebugEnabled())
|
||||||
|
LOG.debug("Reading, fillInterestIfNeeded={} from {} in {}", fillInterestIfNeeded, stream, this);
|
||||||
|
if (stream == null)
|
||||||
|
return Content.Chunk.from(new EOFException("Channel has been released"));
|
||||||
Stream.Data data = stream.readData();
|
Stream.Data data = stream.readData();
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("Read stream data {} in {}", data, this);
|
LOG.debug("Read stream data {} in {}", data, this);
|
||||||
|
@ -84,6 +87,12 @@ public class HttpReceiverOverHTTP3 extends HttpReceiver implements Stream.Client
|
||||||
return (HttpChannelOverHTTP3)super.getHttpChannel();
|
return (HttpChannelOverHTTP3)super.getHttpChannel();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onNewStream(Stream.Client stream)
|
||||||
|
{
|
||||||
|
getHttpChannel().setStream(stream);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onResponse(Stream.Client stream, HeadersFrame frame)
|
public void onResponse(Stream.Client stream, HeadersFrame frame)
|
||||||
{
|
{
|
||||||
|
|
|
@ -139,7 +139,6 @@ public class HttpSenderOverHTTP3 extends HttpSender
|
||||||
|
|
||||||
private Stream onNewStream(Stream stream, HttpRequest request)
|
private Stream onNewStream(Stream stream, HttpRequest request)
|
||||||
{
|
{
|
||||||
getHttpChannel().setStream(stream);
|
|
||||||
long idleTimeout = request.getIdleTimeout();
|
long idleTimeout = request.getIdleTimeout();
|
||||||
if (idleTimeout > 0)
|
if (idleTimeout > 0)
|
||||||
((HTTP3Stream)stream).setIdleTimeout(idleTimeout);
|
((HTTP3Stream)stream).setIdleTimeout(idleTimeout);
|
||||||
|
|
|
@ -106,6 +106,7 @@ public class HTTP3SessionClient extends HTTP3Session implements Session.Client
|
||||||
return promise;
|
return promise;
|
||||||
|
|
||||||
stream.setListener(listener);
|
stream.setListener(listener);
|
||||||
|
stream.onOpen();
|
||||||
|
|
||||||
stream.writeFrame(frame)
|
stream.writeFrame(frame)
|
||||||
.whenComplete((r, x) ->
|
.whenComplete((r, x) ->
|
||||||
|
|
|
@ -43,6 +43,11 @@ public class HTTP3StreamClient extends HTTP3Stream implements Stream.Client
|
||||||
return listener;
|
return listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onOpen()
|
||||||
|
{
|
||||||
|
notifyNewStream();
|
||||||
|
}
|
||||||
|
|
||||||
public void setListener(Stream.Client.Listener listener)
|
public void setListener(Stream.Client.Listener listener)
|
||||||
{
|
{
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
|
@ -67,6 +72,20 @@ public class HTTP3StreamClient extends HTTP3Stream implements Stream.Client
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void notifyNewStream()
|
||||||
|
{
|
||||||
|
Stream.Client.Listener listener = getListener();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (listener != null)
|
||||||
|
listener.onNewStream(this);
|
||||||
|
}
|
||||||
|
catch (Throwable x)
|
||||||
|
{
|
||||||
|
LOG.info("Failure while notifying listener {}", listener, x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void notifyResponse(HeadersFrame frame)
|
private void notifyResponse(HeadersFrame frame)
|
||||||
{
|
{
|
||||||
Stream.Client.Listener listener = getListener();
|
Stream.Client.Listener listener = getListener();
|
||||||
|
|
|
@ -140,6 +140,16 @@ public interface Stream
|
||||||
*/
|
*/
|
||||||
public interface Listener
|
public interface Listener
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* <p>Callback method invoked when a stream is created locally by
|
||||||
|
* {@link Session.Client#newRequest(HeadersFrame, Listener)}.</p>
|
||||||
|
*
|
||||||
|
* @param stream the newly created stream
|
||||||
|
*/
|
||||||
|
public default void onNewStream(Stream.Client stream)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Callback method invoked when a response is received.</p>
|
* <p>Callback method invoked when a response is received.</p>
|
||||||
* <p>To read response content, applications should call
|
* <p>To read response content, applications should call
|
||||||
|
|
|
@ -62,7 +62,6 @@ public class HttpClientLoadTest extends AbstractTest
|
||||||
|
|
||||||
@ParameterizedTest
|
@ParameterizedTest
|
||||||
@MethodSource("transports")
|
@MethodSource("transports")
|
||||||
@Tag("flaky")
|
|
||||||
public void testIterative(Transport transport) throws Exception
|
public void testIterative(Transport transport) throws Exception
|
||||||
{
|
{
|
||||||
server = newServer();
|
server = newServer();
|
||||||
|
|
|
@ -7,6 +7,7 @@ org.eclipse.jetty.jmx.LEVEL=INFO
|
||||||
org.eclipse.jetty.http2.hpack.LEVEL=INFO
|
org.eclipse.jetty.http2.hpack.LEVEL=INFO
|
||||||
#org.eclipse.jetty.http2.client.LEVEL=DEBUG
|
#org.eclipse.jetty.http2.client.LEVEL=DEBUG
|
||||||
#org.eclipse.jetty.http3.LEVEL=DEBUG
|
#org.eclipse.jetty.http3.LEVEL=DEBUG
|
||||||
|
#org.eclipse.jetty.http3.client.LEVEL=DEBUG
|
||||||
org.eclipse.jetty.http3.qpack.LEVEL=INFO
|
org.eclipse.jetty.http3.qpack.LEVEL=INFO
|
||||||
#org.eclipse.jetty.quic.LEVEL=DEBUG
|
#org.eclipse.jetty.quic.LEVEL=DEBUG
|
||||||
org.eclipse.jetty.quic.quiche.LEVEL=INFO
|
org.eclipse.jetty.quic.quiche.LEVEL=INFO
|
||||||
|
|
Loading…
Reference in New Issue