From 3952265e2c4838ac05a5f735b82c7f00599ebcde Mon Sep 17 00:00:00 2001 From: godotg Date: Sun, 17 Sep 2023 23:57:53 +0800 Subject: [PATCH] fix[net]: attachment check error --- .../main/java/com/zfoo/net/router/route/PacketBus.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/net/src/main/java/com/zfoo/net/router/route/PacketBus.java b/net/src/main/java/com/zfoo/net/router/route/PacketBus.java index 76c4f294..71a57a5b 100644 --- a/net/src/main/java/com/zfoo/net/router/route/PacketBus.java +++ b/net/src/main/java/com/zfoo/net/router/route/PacketBus.java @@ -96,13 +96,8 @@ public abstract class PacketBus { // These rules are not necessary, but can reduce us from making low-level mistakes // If the request class name ends with Request which is for outer net client, then the attachment can not be a SignalAttachment // If the request class name ends with Ask which is for intranet client, then attachment can not be a GatewayAttachment - if (attachmentClazz != null) { - if (packetName.endsWith(PacketService.NET_REQUEST_SUFFIX)) { - AssertionUtils.isTrue(!attachmentClazz.equals(SignalAttachment.class), "[class:{}] [method:{}] [packet:{}] must use [attachment:{}]!" - , bean.getClass().getName(), methodName, packetName, GatewayAttachment.class.getCanonicalName()); - } else if (packetName.endsWith(PacketService.NET_ASK_SUFFIX)) { - AssertionUtils.isTrue(!attachmentClazz.equals(GatewayAttachment.class), "[class:{}] [method:{}] [packet:{}] can not match with [attachment:{}]!", bean.getClass().getName(), methodName, packetName, GatewayAttachment.class.getCanonicalName()); - } + if (attachmentClazz != null && packetName.endsWith(PacketService.NET_ASK_SUFFIX)) { + AssertionUtils.isTrue(!attachmentClazz.equals(GatewayAttachment.class), "[class:{}] [method:{}] [packet:{}] can not match with [attachment:{}]!", bean.getClass().getName(), methodName, packetName, GatewayAttachment.class.getCanonicalName()); } var protocolId = Short.MIN_VALUE;