From 5cb7dfa92af451f26a7c4edcf1b41ec839a5b764 Mon Sep 17 00:00:00 2001 From: IzzelAliz Date: Wed, 4 Dec 2019 23:05:56 +0800 Subject: [PATCH 1/2] Update ipc module. --- .../java/io/izzel/taboolib/module/ipc/TabooIpcClientImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module-ipc/src/main/java/io/izzel/taboolib/module/ipc/TabooIpcClientImpl.java b/module-ipc/src/main/java/io/izzel/taboolib/module/ipc/TabooIpcClientImpl.java index f984d8e..aec9ccb 100644 --- a/module-ipc/src/main/java/io/izzel/taboolib/module/ipc/TabooIpcClientImpl.java +++ b/module-ipc/src/main/java/io/izzel/taboolib/module/ipc/TabooIpcClientImpl.java @@ -52,7 +52,7 @@ public class TabooIpcClientImpl implements TabooIpcClient { public boolean readMessage(byte[] buf) { if (!available) throw new IllegalStateException(); if (this.block.getInt(16) == 2) { - this.block.getBytes(64, buf, 0, (int) this.block.getPayloadSize()); + this.block.getBytes(64, buf, 0, Math.min((int) this.block.getPayloadSize(), buf.length)); return this.block.compareAndSwapInt(16, 2, 0); } else return false; } From 88ab61812b4a9abde905b0d8e6206decd8d8dae1 Mon Sep 17 00:00:00 2001 From: IzzelAliz Date: Thu, 5 Dec 2019 15:08:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?Fix=20my=20=E6=86=A8=E6=89=B9=20error.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/izzel/taboolib/module/ipc/MessageBlock.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/module-ipc/src/main/java/io/izzel/taboolib/module/ipc/MessageBlock.java b/module-ipc/src/main/java/io/izzel/taboolib/module/ipc/MessageBlock.java index 5cfdc15..fc91eac 100644 --- a/module-ipc/src/main/java/io/izzel/taboolib/module/ipc/MessageBlock.java +++ b/module-ipc/src/main/java/io/izzel/taboolib/module/ipc/MessageBlock.java @@ -13,9 +13,10 @@ public class MessageBlock { } public void reset() { - int id = getId(); - file.setMemory(baseOffset, size, (byte) 0x00); - putInt(0, id); + file.setMemory(mapAddress(64), getPayloadSize(), (byte) 0x00); + updateTimestamp(); + putInt(12, 0); + putInt(16, 0); } public int getId() {