From 0b7789838bb6cc63d4d6775ef764b7073d451ca6 Mon Sep 17 00:00:00 2001 From: yarnom Date: Wed, 29 Oct 2025 09:58:39 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=96=AD=E8=81=94=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sideslope/rtkcluster/RtkClusterService.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/rtkcluster/RtkClusterService.java b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/rtkcluster/RtkClusterService.java index 1361042f..d048c800 100644 --- a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/rtkcluster/RtkClusterService.java +++ b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/rtkcluster/RtkClusterService.java @@ -250,21 +250,30 @@ public class RtkClusterService implements ApplicationRunner { } if (n > 0 && isLikelyText(probe, n)) { - if (!isSocketAlive(outConn)) { + Socket previous = outConn; + if (!isSocketAlive(previous)) { outConn = s; assigned = true; LOGGER.debug("Endpoint {} OUT connected", port); pumpOut(s, probe, n); } else { - LOGGER.info("Endpoint {} additional OUT connection detected; keeping existing", port); + LOGGER.info("Endpoint {} replacing existing OUT connection", port); + closeQuietly(previous); + outConn = s; + assigned = true; + pumpOut(s, probe, n); } } else { - if (!isSocketAlive(inConn)) { + Socket previous = inConn; + if (!isSocketAlive(previous)) { inConn = s; assigned = true; LOGGER.debug("Endpoint {} IN connected", port); } else { - LOGGER.info("Endpoint {} additional IN connection detected; keeping existing", port); + LOGGER.info("Endpoint {} replacing existing IN connection", port); + closeQuietly(previous); + inConn = s; + assigned = true; } } } catch (IOException e) {