From e98f76a6d709c09f73a10d1475afa635fab2bf11 Mon Sep 17 00:00:00 2001 From: Simon Smith Date: Mon, 7 Oct 2024 23:28:31 +0100 Subject: [PATCH] fix mcrouter links opening multiple ports --- src/MainForm.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/MainForm.cs b/src/MainForm.cs index 93aa929..cdca0ff 100644 --- a/src/MainForm.cs +++ b/src/MainForm.cs @@ -1971,6 +1971,31 @@ namespace MeshCentralRouter } else { + + // See if we already have the right port mapping + NodeClass tmpNode = node; + if (node.mesh != null && node.mesh.relayid != null) + { + if (!meshcentral.nodes.ContainsKey(node.mesh.relayid)) + return; + + tmpNode = meshcentral.nodes[node.mesh.relayid]; + } + foreach (Control c in mapPanel.Controls) + { + if (c.GetType() == typeof(MapUserControl)) + { + MapUserControl cc = (MapUserControl)c; + if ((cc.protocol == (int)x["protocol"]) && (cc.remotePort == (int)x["remotePort"]) && (cc.appId == appId) && + (cc.node == tmpNode || cc.node == node) && (tmpNode == node || cc.remoteIP == node.host)) + { + // Found a match + cc.appButton_Click(this, null); + return; + } + } + } + // Add a new port map MapUserControl map = new MapUserControl(); map.xdebug = debug;