From d929af8029f55f691c2444d3ab8f6e52bf76eea8 Mon Sep 17 00:00:00 2001 From: Jason Mahdjoub Date: Mon, 7 Feb 2022 11:37:57 +0100 Subject: [PATCH] Transfer code from MKLE to UPNPIGD --- .../madkit/kernel/network/UpnpIGDAgent.java | 54 ------------------- .../com/distrimind/madkit/kernel/build.txt | 2 +- 2 files changed, 1 insertion(+), 55 deletions(-) diff --git a/MaDKitLanEdition/src/main/java/com/distrimind/madkit/kernel/network/UpnpIGDAgent.java b/MaDKitLanEdition/src/main/java/com/distrimind/madkit/kernel/network/UpnpIGDAgent.java index 3ec5fffd..0a0aa5bf 100644 --- a/MaDKitLanEdition/src/main/java/com/distrimind/madkit/kernel/network/UpnpIGDAgent.java +++ b/MaDKitLanEdition/src/main/java/com/distrimind/madkit/kernel/network/UpnpIGDAgent.java @@ -212,39 +212,6 @@ static boolean isNotValidRemoteAddress(String host, NetworkAddressFactory networ - static class RequestHttpHandler implements HttpHandler { - - private final com.distrimind.upnp_igd.transport.Router router; - private final NetworkAddressFactory networkAddressFactory; - - RequestHttpHandler(com.distrimind.upnp_igd.transport.Router router, NetworkAddressFactory networkAddressFactory) { - this.router = router; - this.networkAddressFactory=networkAddressFactory; - } - - // This is executed in the request receiving thread! - public void handle(final HttpExchange httpExchange) throws IOException { - InetSocketAddress isa=httpExchange.getRemoteAddress(); - if (isa==null) - return; - InetAddress receivedOnLocalAddress = - networkAddressFactory.getLocalAddress( - null, - isa.getAddress() instanceof Inet6Address, - isa.getAddress() - ); - if (receivedOnLocalAddress==null) - return; - router.received( - new HttpExchangeUpnpStream(router.getProtocolFactory(), httpExchange) { - @Override - protected Connection createConnection() { - return new HttpServerConnection(httpExchange); - } - } - ); - } - } private static class HttpServerConnection implements Connection { protected HttpExchange exchange; @@ -2143,27 +2110,6 @@ public ServiceDescriptorBinder createServiceDescriptorBinderUDA10() { } - @Override - public StreamServer createStreamServer(NetworkAddressFactory networkAddressFactory) { - return new StreamServerImpl( - new StreamServerConfigurationImpl( - networkAddressFactory.getStreamListenPort() - ) - ) { - @Override - synchronized public void init(InetAddress bindAddress, com.distrimind.upnp_igd.transport.Router router) throws InitializationException { - try { - InetSocketAddress socketAddress = new InetSocketAddress(bindAddress, configuration.getListenPort()); - - server = HttpServer.create(socketAddress, configuration.getTcpConnectionBacklog()); - server.createContext("/", new UpnpIGDAgent.RequestHttpHandler(router, networkAddressFactory)); - - } catch (Exception ex) { - throw new InitializationException("Could not initialize " + getClass().getSimpleName() + ": " + ex, ex); - } - } - }; - } } class AndroidUpnpServiceConfiguration extends com.distrimind.upnp_igd.android.AndroidUpnpServiceConfiguration { diff --git a/MaDKitLanEdition/src/main/resources/com/distrimind/madkit/kernel/build.txt b/MaDKitLanEdition/src/main/resources/com/distrimind/madkit/kernel/build.txt index 4ad949fb..e2fede57 100644 --- a/MaDKitLanEdition/src/main/resources/com/distrimind/madkit/kernel/build.txt +++ b/MaDKitLanEdition/src/main/resources/com/distrimind/madkit/kernel/build.txt @@ -1 +1 @@ -5864 +5865