From 13510559c80a6b145c4540c591db9bbe5707abef Mon Sep 17 00:00:00 2001 From: weidong Date: Sat, 4 May 2024 11:09:21 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=812410207=E6=94=B9=E5=9B=9EUDP=E6=8E=A8?= =?UTF-8?q?=E9=80=81=EF=BC=8CTCP=E6=B2=A1=E8=B5=B7=E4=BD=9C=E7=94=A8?= =?UTF-8?q?=EF=BC=8C=E5=8F=8D=E8=80=8C=E6=9C=89=E6=9B=B4=E5=A4=9A=E7=9A=84?= =?UTF-8?q?=E8=BF=9E=E7=BB=AD=E6=97=A0=E5=9B=BA=E5=AE=9A=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sideslope/executor/D331RtcmMessageExecutor.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D331RtcmMessageExecutor.java b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D331RtcmMessageExecutor.java index 8d876852..36228ce3 100644 --- a/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D331RtcmMessageExecutor.java +++ b/sec-beidou-rtcm/src/main/java/com/imdroid/sideslope/executor/D331RtcmMessageExecutor.java @@ -44,16 +44,12 @@ public class D331RtcmMessageExecutor implements Executor if(device1.getOpMode() == GnssDevice.OP_MODE_USE) { byte[] forwardBytes = message.getSrcData(); - boolean useUDPChannel = true; - if(device1.getDeviceId().equals("2410207")) useUDPChannel = false; // 要求快速转发,因此用缓存,不要每次都查数据库 List deviceList = deviceService.findByParentId(id); for (Device device : deviceList) { if (device.getOpMode() != GnssDevice.OP_MODE_USE) continue; String deviceId = device.getDeviceId(); - DeviceChannel deviceChannel = - useUDPChannel?OnlineChannels.INSTANCE.getDataChannel(deviceId):OnlineChannels.INSTANCE.getConfigChannel(deviceId); - if(deviceChannel!=null) { + OnlineChannels.INSTANCE.get(deviceId).ifPresent(deviceChannel -> { if (logger.isDebugEnabled()) { logger.debug("forward d331 rtcm message to device {}", deviceId); } @@ -63,7 +59,7 @@ public class D331RtcmMessageExecutor implements Executor ByteBuf buf = Unpooled.buffer(); buf.writeBytes(forwardBytes); deviceChannel.writeAndFlush(buf); - } + }); } }