Fix simple NetMarshalClient bug.

Oops
This commit is contained in:
Captain ALM 2023-05-20 19:50:13 +01:00
parent 1285317289
commit 3934e2e861
Signed by: alfred
GPG Key ID: 4E4ADD02609997B1

View File

@ -441,7 +441,7 @@ public class NetMarshalClient implements Closeable {
*/ */
public IPacket receivePacket() throws InterruptedException { public IPacket receivePacket() throws InterruptedException {
synchronized (slockReceive) { synchronized (slockReceive) {
while (receivedPackets.size() < 1) slockReceive.wait(); while (running && receivedPackets.size() < 1) slockReceive.wait();
return receivedPackets.poll(); return receivedPackets.poll();
} }
} }
@ -616,6 +616,9 @@ public class NetMarshalClient implements Closeable {
fragmentFinishSendMonitorThread.interrupt(); fragmentFinishSendMonitorThread.interrupt();
} }
receivedPackets.clear(); receivedPackets.clear();
synchronized (slockReceive) {
slockReceive.notifyAll();
}
try { try {
inputStream.close(); inputStream.close();
} finally { } finally {