From 44606d94bea6069788906c3c7136eeb2117e3aad Mon Sep 17 00:00:00 2001 From: Ludovic Orban Date: Tue, 23 Mar 2021 14:51:47 +0100 Subject: [PATCH] rename connectors Signed-off-by: Ludovic Orban --- .../jetty/http3/client/ClientQuicConnection.java | 2 +- ...gramConnector.java => ClientQuicConnector.java} | 6 +++--- .../jetty/http3/client/ClientQuicSession.java | 3 +-- .../http3/client/HttpClientTransportOverQuic.java | 4 ++-- .../jetty/http3/client/End2EndClientTest.java | 8 ++++---- ...gramConnector.java => ServerQuicConnector.java} | 10 +++++----- ...ectorTest.java => ServerQuicConnectorTest.java} | 14 +++++++------- 7 files changed, 23 insertions(+), 24 deletions(-) rename jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/{ClientDatagramConnector.java => ClientQuicConnector.java} (98%) rename jetty-http3/http3-server/src/main/java/org/eclipse/jetty/http3/server/{ServerDatagramConnector.java => ServerQuicConnector.java} (97%) rename jetty-http3/http3-server/src/test/java/org/eclipse/jetty/http3/server/{ServerDatagramConnectorTest.java => ServerQuicConnectorTest.java} (88%) 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 4c46cf24c95..5ab6d1c1ea1 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 @@ -52,7 +52,7 @@ public class ClientQuicConnection extends QuicConnection try { - InetSocketAddress remoteAddress = (InetSocketAddress)context.get(ClientDatagramConnector.REMOTE_SOCKET_ADDRESS_CONTEXT_KEY); + InetSocketAddress remoteAddress = (InetSocketAddress)context.get(ClientQuicConnector.REMOTE_SOCKET_ADDRESS_CONTEXT_KEY); QuicheConnection quicheConnection = QuicheConnection.connect(getQuicheConfig(), remoteAddress); QuicSession session = new ClientQuicSession(getExecutor(), getScheduler(), getByteBufferPool(), quicheConnection, this, remoteAddress, context); pendingSessions.put(remoteAddress, session); diff --git a/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientDatagramConnector.java b/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicConnector.java similarity index 98% rename from jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientDatagramConnector.java rename to jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicConnector.java index d3f9aa5332d..83331014be4 100644 --- a/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientDatagramConnector.java +++ b/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicConnector.java @@ -50,7 +50,7 @@ import org.eclipse.jetty.util.thread.Scheduler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ClientDatagramConnector extends ContainerLifeCycle implements IClientConnector +public class ClientQuicConnector extends ContainerLifeCycle implements IClientConnector { public static final String CLIENT_CONNECTOR_CONTEXT_KEY = "org.eclipse.jetty.client.connector"; public static final String REMOTE_SOCKET_ADDRESS_CONTEXT_KEY = CLIENT_CONNECTOR_CONTEXT_KEY + ".remoteSocketAddress"; @@ -69,7 +69,7 @@ public class ClientDatagramConnector extends ContainerLifeCycle implements IClie private SocketAddress bindAddress; private boolean reuseAddress = true; - public ClientDatagramConnector(Origin.Protocol... protocols) + public ClientQuicConnector(Origin.Protocol... protocols) { String[] applicationProtos = Arrays.stream(protocols) .flatMap(protocol -> protocol.getProtocols().stream()) @@ -331,7 +331,7 @@ public class ClientDatagramConnector extends ContainerLifeCycle implements IClie @Override protected EndPoint newEndPoint(SelectableChannel channel, ManagedSelector selector, SelectionKey selectionKey) { - EndPoint endPoint = ClientDatagramConnector.this.newEndPoint((DatagramChannel)channel, selector, selectionKey); + EndPoint endPoint = ClientQuicConnector.this.newEndPoint((DatagramChannel)channel, selector, selectionKey); endPoint.setIdleTimeout(getIdleTimeout().toMillis()); return endPoint; } diff --git a/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicSession.java b/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicSession.java index 96c2f848768..bfcc32dff38 100644 --- a/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicSession.java +++ b/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/ClientQuicSession.java @@ -22,7 +22,6 @@ import org.eclipse.jetty.http3.common.QuicConnection; import org.eclipse.jetty.http3.common.QuicSession; import org.eclipse.jetty.http3.common.QuicStreamEndPoint; import org.eclipse.jetty.http3.quiche.QuicheConnection; -import org.eclipse.jetty.http3.quiche.QuicheConnectionId; import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.ClientConnectionFactory; import org.eclipse.jetty.io.Connection; @@ -42,7 +41,7 @@ public class ClientQuicSession extends QuicSession @Override protected QuicStreamEndPoint createQuicStreamEndPoint(long streamId) { - ClientConnectionFactory connectionFactory = (ClientConnectionFactory)context.get(ClientDatagramConnector.CLIENT_CONNECTION_FACTORY_CONTEXT_KEY); + ClientConnectionFactory connectionFactory = (ClientConnectionFactory)context.get(ClientQuicConnector.CLIENT_CONNECTION_FACTORY_CONTEXT_KEY); QuicStreamEndPoint endPoint = new QuicStreamEndPoint(getScheduler(), this, streamId); Connection connection; try diff --git a/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/HttpClientTransportOverQuic.java b/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/HttpClientTransportOverQuic.java index 55c6555366e..16d27b9f7f3 100644 --- a/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/HttpClientTransportOverQuic.java +++ b/jetty-http3/http3-client/src/main/java/org/eclipse/jetty/http3/client/HttpClientTransportOverQuic.java @@ -36,14 +36,14 @@ import org.eclipse.jetty.util.annotation.ManagedObject; public class HttpClientTransportOverQuic extends AbstractHttpClientTransport { private final ClientConnectionFactory connectionFactory = new HttpClientConnectionFactory(); - private final ClientDatagramConnector connector; + private final ClientQuicConnector connector; private final Origin.Protocol protocol; public HttpClientTransportOverQuic() { //TODO the ClientConnectionFactory should be built according to the Protocol instance. See HttpClientTransportDynamic protocol = new Origin.Protocol(HttpClientConnectionFactory.HTTP11.getProtocols(true), false); - connector = new ClientDatagramConnector(protocol); + connector = new ClientQuicConnector(protocol); addBean(connector); setConnectionPoolFactory(destination -> { 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 3eacb594d44..2c3fdfbc848 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 @@ -22,7 +22,7 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.api.ContentResponse; import org.eclipse.jetty.http.HttpCompliance; -import org.eclipse.jetty.http3.server.ServerDatagramConnector; +import org.eclipse.jetty.http3.server.ServerQuicConnector; import org.eclipse.jetty.server.HttpConfiguration; import org.eclipse.jetty.server.HttpConnectionFactory; import org.eclipse.jetty.server.Request; @@ -48,9 +48,9 @@ public class End2EndClientTest config.setHttpCompliance(HttpCompliance.LEGACY); // enable HTTP/0.9 HttpConnectionFactory connectionFactory = new HttpConnectionFactory(config); - ServerDatagramConnector serverDatagramConnector = new ServerDatagramConnector(server, connectionFactory); - serverDatagramConnector.setPort(8443); - server.addConnector(serverDatagramConnector); + ServerQuicConnector connector = new ServerQuicConnector(server, connectionFactory); + connector.setPort(8443); + server.addConnector(connector); server.setHandler(new AbstractHandler() { diff --git a/jetty-http3/http3-server/src/main/java/org/eclipse/jetty/http3/server/ServerDatagramConnector.java b/jetty-http3/http3-server/src/main/java/org/eclipse/jetty/http3/server/ServerQuicConnector.java similarity index 97% rename from jetty-http3/http3-server/src/main/java/org/eclipse/jetty/http3/server/ServerDatagramConnector.java rename to jetty-http3/http3-server/src/main/java/org/eclipse/jetty/http3/server/ServerQuicConnector.java index a93783ca995..98a66a96dbd 100644 --- a/jetty-http3/http3-server/src/main/java/org/eclipse/jetty/http3/server/ServerDatagramConnector.java +++ b/jetty-http3/http3-server/src/main/java/org/eclipse/jetty/http3/server/ServerQuicConnector.java @@ -40,14 +40,14 @@ import org.eclipse.jetty.util.IO; import org.eclipse.jetty.util.annotation.Name; import org.eclipse.jetty.util.thread.Scheduler; -public class ServerDatagramConnector extends AbstractNetworkConnector +public class ServerQuicConnector extends AbstractNetworkConnector { private final ServerDatagramSelectorManager _manager; private final QuicheConfig _quicheConfig; private volatile DatagramChannel _datagramChannel; private volatile int _localPort = -1; - public ServerDatagramConnector( + public ServerQuicConnector( @Name("server") Server server, @Name("executor") Executor executor, @Name("scheduler") Scheduler scheduler, @@ -89,7 +89,7 @@ public class ServerDatagramConnector extends AbstractNetworkConnector _quicheConfig.setApplicationProtos(protocols.toArray(new String[0])); } - public ServerDatagramConnector( + public ServerQuicConnector( @Name("server") Server server, @Name("factories") ConnectionFactory... factories) { @@ -211,13 +211,13 @@ public class ServerDatagramConnector extends AbstractNetworkConnector @Override public Connection newConnection(SelectableChannel channel, EndPoint endpoint, Object attachment) throws IOException { - return new ServerQuicConnection(getExecutor(), getScheduler(), getByteBufferPool(), endpoint, _quicheConfig, ServerDatagramConnector.this); + return new ServerQuicConnection(getExecutor(), getScheduler(), getByteBufferPool(), endpoint, _quicheConfig, ServerQuicConnector.this); } @Override public String toString() { - return String.format("DatagramSelectorManager@%s", ServerDatagramConnector.this); + return String.format("DatagramSelectorManager@%s", ServerQuicConnector.this); } class Accept implements ManagedSelector.SelectorUpdate, ManagedSelector.Selectable, Runnable, Closeable diff --git a/jetty-http3/http3-server/src/test/java/org/eclipse/jetty/http3/server/ServerDatagramConnectorTest.java b/jetty-http3/http3-server/src/test/java/org/eclipse/jetty/http3/server/ServerQuicConnectorTest.java similarity index 88% rename from jetty-http3/http3-server/src/test/java/org/eclipse/jetty/http3/server/ServerDatagramConnectorTest.java rename to jetty-http3/http3-server/src/test/java/org/eclipse/jetty/http3/server/ServerQuicConnectorTest.java index 206fc5c8648..03b79548ba0 100644 --- a/jetty-http3/http3-server/src/test/java/org/eclipse/jetty/http3/server/ServerDatagramConnectorTest.java +++ b/jetty-http3/http3-server/src/test/java/org/eclipse/jetty/http3/server/ServerQuicConnectorTest.java @@ -30,7 +30,7 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.handler.AbstractHandler; import org.junit.jupiter.api.Test; -public class ServerDatagramConnectorTest +public class ServerQuicConnectorTest { @Test public void testSmall() throws Exception @@ -41,9 +41,9 @@ public class ServerDatagramConnectorTest config.setHttpCompliance(HttpCompliance.LEGACY); // enable HTTP/0.9 HttpConnectionFactory connectionFactory = new HttpConnectionFactory(config); - ServerDatagramConnector serverDatagramConnector = new ServerDatagramConnector(server, connectionFactory); - serverDatagramConnector.setPort(8443); - server.addConnector(serverDatagramConnector); + ServerQuicConnector connector = new ServerQuicConnector(server, connectionFactory); + connector.setPort(8443); + server.addConnector(connector); server.setHandler(new AbstractHandler() { @@ -77,9 +77,9 @@ public class ServerDatagramConnectorTest config.setHttpCompliance(HttpCompliance.LEGACY); // enable HTTP/0.9 HttpConnectionFactory connectionFactory = new HttpConnectionFactory(config); - ServerDatagramConnector serverDatagramConnector = new ServerDatagramConnector(server, connectionFactory); - serverDatagramConnector.setPort(8443); - server.addConnector(serverDatagramConnector); + ServerQuicConnector connector = new ServerQuicConnector(server, connectionFactory); + connector.setPort(8443); + server.addConnector(connector); server.setHandler(new AbstractHandler() {