Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-11.0.x

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2023-05-15 10:03:43 +02:00
commit 33e9b5343f
6 changed files with 47 additions and 2 deletions

View File

@ -106,6 +106,7 @@ public class HTTP3SessionClient extends HTTP3Session implements Session.Client
return promise;
stream.setListener(listener);
stream.onOpen();
stream.writeFrame(frame)
.whenComplete((r, x) ->

View File

@ -42,6 +42,11 @@ public class HTTP3StreamClient extends HTTP3Stream implements Stream.Client
return listener;
}
public void onOpen()
{
notifyNewStream();
}
public void setListener(Stream.Client.Listener listener)
{
this.listener = listener;
@ -65,6 +70,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)
{
Stream.Client.Listener listener = getListener();

View File

@ -138,6 +138,16 @@ public interface Stream
*/
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>To read response content, applications should call

View File

@ -59,9 +59,24 @@ public class HttpReceiverOverHTTP3 extends HttpReceiver implements Stream.Client
return;
if (notifySuccess)
{
responseSuccess(exchange);
}
else
getHttpChannel().getStream().demand();
{
Stream stream = getHttpChannel().getStream();
if (LOG.isDebugEnabled())
LOG.debug("Demanding from {} in {}", stream, this);
if (stream == null)
return;
stream.demand();
}
}
@Override
public void onNewStream(Stream.Client stream)
{
getHttpChannel().setStream(stream);
}
@Override

View File

@ -138,7 +138,6 @@ public class HttpSenderOverHTTP3 extends HttpSender
private Stream onNewStream(Stream stream, HttpRequest request)
{
getHttpChannel().setStream(stream);
long idleTimeout = request.getIdleTimeout();
if (idleTimeout > 0)
((HTTP3Stream)stream).setIdleTimeout(idleTimeout);

View File

@ -7,6 +7,7 @@ org.eclipse.jetty.jmx.LEVEL=INFO
org.eclipse.jetty.http2.hpack.LEVEL=INFO
#org.eclipse.jetty.http2.client.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.quic.LEVEL=DEBUG
org.eclipse.jetty.quic.quiche.LEVEL=INFO