Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Gateways: Disconnect and destroy all active tunnel sessions when closing a `GatewayClientConnector` (#2497)

Panos Kalogeropoulosd1bcf62c6ea6
diff --git a/manager/src/main/java/org/openremote/manager/gateway/GatewayClientConnector.java b/manager/src/main/java/org/openremote/manager/gateway/GatewayClientConnector.java
index 0f2c41e3d..fe66ad1a5 100644
--- a/manager/src/main/java/org/openremote/manager/gateway/GatewayClientConnector.java
+++ b/manager/src/main/java/org/openremote/manager/gateway/GatewayClientConnector.java
@@ -133,6 +133,12 @@ public class GatewayClientConnector implements AutoCloseable {
client.removeAllConnectionStatusConsumers();
client.removeAllMessageConsumers();
client.setEncoderDecoderProvider(null);
+
+ if (this.activeTunnelSessions != null) {
+ this.activeTunnelSessions.forEach(GatewayTunnelSession::disconnect);
+ this.activeTunnelSessions.clear();
+ }
+
} catch (Exception e) {
LOG.log(Level.WARNING, "An exception occurred whilst trying to disconnect the gateway IO client", e);
} finally {