From fb095ad52cbcec90b042fd51d7fb8907920661de Mon Sep 17 00:00:00 2001 From: yarnom Date: Wed, 29 Oct 2025 11:35:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8E=92=E6=9F=A5TCP=20SERVER=20?= =?UTF-8?q?=E5=8F=91=E5=B8=83RTCM=E6=B6=88=E6=81=AF=E7=9A=84=E6=96=AD?= =?UTF-8?q?=E8=81=94=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rtkcluster/RtkClusterService.java | 24 +++++++++++++++---- 1 file changed, 20 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 ba650286..35a16fbb 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 @@ -288,15 +288,31 @@ public class RtkClusterService implements ApplicationRunner { private void dequeueLoop() { byte[] pending = null; + boolean lastWaitLogged = false; while (true) { try { + Socket out = outConn; Socket sink = inConn; - if (sink == null || sink.isClosed() || sink == outConn) { - // wait for a valid IN sink before consuming queue - ensureInCandidate(); - Thread.sleep(20); + if (out == null) { + // wait until OUT连接已就绪(rtkrcv 已输出首包/特征头) + if (!lastWaitLogged) { + LOGGER.info("Endpoint {} waiting for OUT to be ready before sending RTCM", port); + lastWaitLogged = true; + } + Thread.sleep(50); continue; } + if (sink == null || sink.isClosed() || sink == out) { + // 等待有效的 IN 连接(且不能与 OUT 相同) + if (!lastWaitLogged) { + LOGGER.info("Endpoint {} waiting for IN to be ready before sending RTCM", port); + lastWaitLogged = true; + } + ensureInCandidate(); + Thread.sleep(50); + continue; + } + lastWaitLogged = false; if (pending == null) { pending = rtcmQueue.pollFirst(100, TimeUnit.MILLISECONDS); if (pending == null) continue;