clean up alpn protocol configuration

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
This commit is contained in:
Ludovic Orban 2021-03-24 12:36:49 +01:00 committed by Simone Bordet
parent 82960f417e
commit a12a2f34e5
2 changed files with 17 additions and 13 deletions

View File

@ -69,19 +69,9 @@ public class ClientQuicConnector extends ContainerLifeCycle implements IClientCo
private SocketAddress bindAddress; private SocketAddress bindAddress;
private boolean reuseAddress = true; private boolean reuseAddress = true;
public ClientQuicConnector(Origin.Protocol protocol) public ClientQuicConnector(QuicheConfig quicheConfig)
{ {
// TODO make the QuicheConfig configurable this.quicheConfig = quicheConfig;
quicheConfig = new QuicheConfig();
quicheConfig.setApplicationProtos(protocol.getProtocols().toArray(new String[0]));
quicheConfig.setMaxIdleTimeout(5000L);
quicheConfig.setInitialMaxData(10000000L);
quicheConfig.setInitialMaxStreamDataBidiLocal(10000000L);
quicheConfig.setInitialMaxStreamDataUni(10000000L);
quicheConfig.setInitialMaxStreamsBidi(100L);
quicheConfig.setInitialMaxStreamsUni(100L);
quicheConfig.setDisableActiveMigration(true);
quicheConfig.setVerifyPeer(false);
} }
public Executor getExecutor() public Executor getExecutor()

View File

@ -28,6 +28,7 @@ import org.eclipse.jetty.client.MultiplexConnectionPool;
import org.eclipse.jetty.client.MultiplexHttpDestination; import org.eclipse.jetty.client.MultiplexHttpDestination;
import org.eclipse.jetty.client.Origin; import org.eclipse.jetty.client.Origin;
import org.eclipse.jetty.client.http.HttpClientConnectionFactory; import org.eclipse.jetty.client.http.HttpClientConnectionFactory;
import org.eclipse.jetty.http3.quiche.QuicheConfig;
import org.eclipse.jetty.io.ClientConnectionFactory; import org.eclipse.jetty.io.ClientConnectionFactory;
import org.eclipse.jetty.io.ClientConnector; import org.eclipse.jetty.io.ClientConnector;
import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.Connection;
@ -50,8 +51,21 @@ public class HttpClientTransportOverQuic extends AbstractHttpClientTransport
public HttpClientTransportOverQuic(ClientConnectionFactory.Info... factoryInfos) public HttpClientTransportOverQuic(ClientConnectionFactory.Info... factoryInfos)
{ {
List<String> protocolNames = Arrays.stream(factoryInfos).flatMap(info -> info.getProtocols(true).stream()).collect(Collectors.toList()); List<String> protocolNames = Arrays.stream(factoryInfos).flatMap(info -> info.getProtocols(true).stream()).collect(Collectors.toList());
// TODO make the QuicheConfig configurable
QuicheConfig quicheConfig = new QuicheConfig();
quicheConfig.setApplicationProtos(protocolNames.toArray(new String[0]));
quicheConfig.setMaxIdleTimeout(5000L);
quicheConfig.setInitialMaxData(10000000L);
quicheConfig.setInitialMaxStreamDataBidiLocal(10000000L);
quicheConfig.setInitialMaxStreamDataUni(10000000L);
quicheConfig.setInitialMaxStreamsBidi(100L);
quicheConfig.setInitialMaxStreamsUni(100L);
quicheConfig.setDisableActiveMigration(true);
quicheConfig.setVerifyPeer(false);
protocol = new Origin.Protocol(protocolNames, false); protocol = new Origin.Protocol(protocolNames, false);
connector = new ClientQuicConnector(protocol); connector = new ClientQuicConnector(quicheConfig);
addBean(connector); addBean(connector);
setConnectionPoolFactory(destination -> setConnectionPoolFactory(destination ->
{ {