Update ipc module.

This commit is contained in:
IzzelAliz 2019-12-04 23:05:56 +08:00
parent 962bfa5256
commit 5cb7dfa92a

View File

@ -52,7 +52,7 @@ public class TabooIpcClientImpl implements TabooIpcClient {
public boolean readMessage(byte[] buf) { public boolean readMessage(byte[] buf) {
if (!available) throw new IllegalStateException(); if (!available) throw new IllegalStateException();
if (this.block.getInt(16) == 2) { 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); return this.block.compareAndSwapInt(16, 2, 0);
} else return false; } else return false;
} }