get rid of QuicheConfig in QuicClientConnector

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2021-03-26 17:49:18 +01:00 committed by Simone Bordet
parent b8f39b5b2c
commit 0771d860df
3 changed files with 17 additions and 31 deletions

View File

@ -42,13 +42,11 @@ public class ClientQuicConnection extends QuicConnection
private static final Logger LOG = LoggerFactory.getLogger(ClientQuicConnection.class);
private final Map<InetSocketAddress, QuicSession> pendingSessions = new ConcurrentHashMap<>();
private final QuicheConfig quicheConfig;
private final Map<String, Object> context;
public ClientQuicConnection(Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, EndPoint endp, QuicheConfig quicheConfig, Map<String, Object> context)
public ClientQuicConnection(Executor executor, Scheduler scheduler, ByteBufferPool byteBufferPool, EndPoint endp, Map<String, Object> 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<String> 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<String> 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);

View File

@ -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<String, Object> contextMap = connect.getContext();
return new ClientQuicConnection(getExecutor(), getScheduler(), getByteBufferPool(), endPoint, quicheConfig, contextMap);
return new ClientQuicConnection(getExecutor(), getScheduler(), getByteBufferPool(), endPoint, contextMap);
}
@Override

View File

@ -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();
}