diff --git a/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicConnection.java b/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicConnection.java index 2257977a40a..b4a4017acf9 100644 --- a/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicConnection.java +++ b/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicConnection.java @@ -42,13 +42,11 @@ public class ClientQuicConnection extends QuicConnection private static final Logger LOG = LoggerFactory.getLogger(ClientQuicConnection.class); private final Map pendingSessions = new ConcurrentHashMap<>(); - private final QuicheConfig quicheConfig; private final Map context; - public ClientQuicConnection(Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, EndPoint endp, QuicheConfig quicheConfig, Map context) + public ClientQuicConnection(Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, EndPoint endp, Map context) { super(executor, scheduler, byteBufferPool, endp); - this.quicheConfig = quicheConfig; this.context = context; } @@ -61,10 +59,19 @@ public class ClientQuicConnection extends QuicConnection { InetSocketAddress remoteAddress = (InetSocketAddress)context.get(ClientConnector.REMOTE_SOCKET_ADDRESS_CONTEXT_KEY); HttpDestination destination = (HttpDestination)context.get(HttpClientTransport.HTTP_DESTINATION_CONTEXT_KEY); - List protocols = destination.getOrigin().getProtocol().getProtocols(); - // TODO: create quiche config here, pulling the config from somewhere else TBD (context?) + // TODO: pull the config settings from somewhere else TBD (context?) + QuicheConfig quicheConfig = new QuicheConfig(); + List protocols = destination.getOrigin().getProtocol().getProtocols(); quicheConfig.setApplicationProtos(protocols.toArray(new String[0])); + quicheConfig.setDisableActiveMigration(true); + quicheConfig.setVerifyPeer(false); + quicheConfig.setMaxIdleTimeout(5000L); + quicheConfig.setInitialMaxData(10_000_000L); + quicheConfig.setInitialMaxStreamDataBidiLocal(10_000_000L); + quicheConfig.setInitialMaxStreamDataUni(10_000_000L); + quicheConfig.setInitialMaxStreamsBidi(100L); + quicheConfig.setInitialMaxStreamsUni(100L); QuicheConnection quicheConnection = QuicheConnection.connect(quicheConfig, remoteAddress); QuicSession session = new ClientQuicSession(getExecutor(), getScheduler(), getByteBufferPool(), quicheConnection, this, remoteAddress, context); diff --git a/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicConnector.java b/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/QuicClientConnector.java similarity index 88% rename from jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicConnector.java rename to jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/QuicClientConnector.java index d048ae3c604..6e45ebc828d 100644 --- a/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicConnector.java +++ b/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/QuicClientConnector.java @@ -27,7 +27,6 @@ import java.util.concurrent.Executor; import java.util.concurrent.atomic.AtomicBoolean; import org.eclipse.jetty.http3.common.QuicDatagramEndPoint; -import org.eclipse.jetty.http3.quiche.QuicheConfig; import org.eclipse.jetty.io.ClientConnector; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.EndPoint; @@ -39,11 +38,9 @@ import org.eclipse.jetty.util.thread.Scheduler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ClientQuicConnector extends ClientConnector +public class QuicClientConnector extends ClientConnector { - private static final Logger LOG = LoggerFactory.getLogger(ClientQuicConnector.class); - - private final QuicheConfig quicheConfig = new QuicheConfig(); + private static final Logger LOG = LoggerFactory.getLogger(QuicClientConnector.class); @Override public boolean isConnectBlocking() @@ -62,24 +59,6 @@ public class ClientQuicConnector extends ClientConnector return true; } - @Override - protected void doStart() throws Exception - { - // TODO: move the creation of quiche config to ClientQuicConnection.onOpen() - - // TODO make these QuicheConfig settings configurable - quicheConfig.setDisableActiveMigration(true); - quicheConfig.setVerifyPeer(false); - quicheConfig.setMaxIdleTimeout(5000L); - quicheConfig.setInitialMaxData(10_000_000L); - quicheConfig.setInitialMaxStreamDataBidiLocal(10_000_000L); - quicheConfig.setInitialMaxStreamDataUni(10_000_000L); - quicheConfig.setInitialMaxStreamsBidi(100L); - quicheConfig.setInitialMaxStreamsUni(100L); - - super.doStart(); - } - @Override protected SelectorManager newSelectorManager() { @@ -165,7 +144,7 @@ public class ClientQuicConnector extends ClientConnector @Override protected EndPoint newEndPoint(SelectableChannel channel, ManagedSelector selector, SelectionKey selectionKey) { - EndPoint endPoint = ClientQuicConnector.this.newEndPoint(channel, selector, selectionKey); + EndPoint endPoint = QuicClientConnector.this.newEndPoint(channel, selector, selectionKey); endPoint.setIdleTimeout(getIdleTimeout().toMillis()); return endPoint; } @@ -175,7 +154,7 @@ public class ClientQuicConnector extends ClientConnector { Connect connect = (Connect)attachment; Map contextMap = connect.getContext(); - return new ClientQuicConnection(getExecutor(), getScheduler(), getByteBufferPool(), endPoint, quicheConfig, contextMap); + return new ClientQuicConnection(getExecutor(), getScheduler(), getByteBufferPool(), endPoint, contextMap); } @Override diff --git a/jetty-http3/http3-client/src/test/java/org/eclipse/jetty/http3/client/End2EndClientTest.java b/jetty-http3/http3-client/src/test/java/org/eclipse/jetty/http3/client/End2EndClientTest.java index 6c7cea78620..27d0b58cf1d 100644 --- a/jetty-http3/http3-client/src/test/java/org/eclipse/jetty/http3/client/End2EndClientTest.java +++ b/jetty-http3/http3-client/src/test/java/org/eclipse/jetty/http3/client/End2EndClientTest.java @@ -75,7 +75,7 @@ public class End2EndClientTest server.start(); - HttpClientTransportOverHTTP transport = new HttpClientTransportOverHTTP(new ClientQuicConnector()); + HttpClientTransportOverHTTP transport = new HttpClientTransportOverHTTP(new QuicClientConnector()); client = new HttpClient(transport); client.start(); }