diff --git a/run/src/main/java/org/wowtools/hppt/common/server/LoginClientService.java b/run/src/main/java/org/wowtools/hppt/common/server/LoginClientService.java index 5bd7e1a..9f384a4 100644 --- a/run/src/main/java/org/wowtools/hppt/common/server/LoginClientService.java +++ b/run/src/main/java/org/wowtools/hppt/common/server/LoginClientService.java @@ -105,7 +105,7 @@ public List fetchBytes(long maxReturnBodySize) { break; } bytesList.add(next); - currentReturnBodySize += next.sessionBytes.getBytes().length; + currentReturnBodySize += next.sessionBytes().getBytes().length; } } return merge(bytesList); @@ -128,14 +128,14 @@ public List fetchBytesBlocked(long maxReturnBodySize) { return merge(bytesList); } else { //根据maxReturnBodySize的限制取出队列中的数据返回 - long currentReturnBodySize = first.sessionBytes.getBytes().length; + long currentReturnBodySize = first.sessionBytes().getBytes().length; while (currentReturnBodySize < maxReturnBodySize) { SendAbleSessionBytes next = sessionBytesQueue.poll(); if (null == next) { break; } bytesList.add(next); - currentReturnBodySize += next.sessionBytes.getBytes().length; + currentReturnBodySize += next.sessionBytes().getBytes().length; } return merge(bytesList); } @@ -150,9 +150,9 @@ private static final class MergeCell { private static List merge(List bytesList) { Map bytesMap = new HashMap<>(); for (SendAbleSessionBytes ssb : bytesList) { - MergeCell mergeCell = bytesMap.computeIfAbsent(ssb.sessionBytes.getSessionId(), (r) -> new MergeCell()); - mergeCell.bytesList.add(ssb.sessionBytes.getBytes()); - mergeCell.callBacks.add(ssb.callBack); + MergeCell mergeCell = bytesMap.computeIfAbsent(ssb.sessionBytes().getSessionId(), (r) -> new MergeCell()); + mergeCell.bytesList.add(ssb.sessionBytes().getBytes()); + mergeCell.callBacks.add(ssb.callBack()); } List res = new ArrayList<>(bytesMap.size()); bytesMap.forEach((sessionId, mergeCell) -> { diff --git a/run/src/main/java/org/wowtools/hppt/common/server/ServerTalker.java b/run/src/main/java/org/wowtools/hppt/common/server/ServerTalker.java index 374b6f0..b91e306 100644 --- a/run/src/main/java/org/wowtools/hppt/common/server/ServerTalker.java +++ b/run/src/main/java/org/wowtools/hppt/common/server/ServerTalker.java @@ -130,13 +130,13 @@ public static void replyToClient(CommonConfig config, ServerSessionManager serve if (null != fetchBytes && !fetchBytes.isEmpty()) { if (DebugConfig.OpenSerialNumber) { for (SendAbleSessionBytes ssb : fetchBytes) { - log.debug("生成向客户端回复的消息 (fetchBytes.size()); for (SendAbleSessionBytes ssb : fetchBytes) { - SessionBytes fetchByte = ssb.sessionBytes; + SessionBytes fetchByte = ssb.sessionBytes(); sessionBytes.add(fetchByte); } empty = false; @@ -167,7 +167,7 @@ public static void replyToClient(CommonConfig config, ServerSessionManager serve if (null != fetchBytes) { for (SendAbleSessionBytes fetchByte : fetchBytes) { - sendAbleSessionBytesResultQueue.add(new SendAbleSessionBytesResult(success, fetchByte.callBack)); + sendAbleSessionBytesResultQueue.add(new SendAbleSessionBytesResult(success, fetchByte.callBack())); } } diff --git a/run/src/main/java/org/wowtools/hppt/run/sc/common/PortReceiver.java b/run/src/main/java/org/wowtools/hppt/run/sc/common/PortReceiver.java index fe5d65a..78ba0fc 100644 --- a/run/src/main/java/org/wowtools/hppt/run/sc/common/PortReceiver.java +++ b/run/src/main/java/org/wowtools/hppt/run/sc/common/PortReceiver.java @@ -56,6 +56,12 @@ public PortReceiver(ScConfig config, ClientSessionService clientSessionService) } log.info("连接建立完成"); Thread.startVirtualThread(() -> { + //休眠一下等待clientSessionService初始化完成,解决native下启动时可能得空指针问题 + try { + Thread.sleep(10); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } //建立连接后,获取时间戳 clientSessionService.sendBytesToServer(GridAesCipherUtil.encrypt("dt".getBytes(StandardCharsets.UTF_8))); //等待时间戳返回