Merge remote-tracking branch 'origin/master'

This commit is contained in:
sky 2019-12-11 17:42:43 +08:00
commit 9aa72cdc91
2 changed files with 5 additions and 4 deletions

View File

@ -13,9 +13,10 @@ public class MessageBlock {
} }
public void reset() { public void reset() {
int id = getId(); file.setMemory(mapAddress(64), getPayloadSize(), (byte) 0x00);
file.setMemory(baseOffset, size, (byte) 0x00); updateTimestamp();
putInt(0, id); putInt(12, 0);
putInt(16, 0);
} }
public int getId() { public int getId() {

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;
} }