proxy progress

This commit is contained in:
rusefi 2020-07-08 21:37:15 -04:00
parent 565462cf80
commit d842049b6f
1 changed files with 9 additions and 3 deletions

View File

@ -141,12 +141,18 @@ public class IncomingDataBuffer {
} }
} }
public byte readByte() throws EOFException { public byte readByte() throws EOFException, InterruptedException {
boolean timeout = waitForBytes("readByte", System.currentTimeMillis(), 1);
if (timeout)
throw new IllegalStateException("Timeout in readByte");
return (byte) getByte(); return (byte) getByte();
} }
public int readInt() throws EOFException { public int readInt() throws EOFException, InterruptedException {
return getInt(); boolean timeout = waitForBytes("readInt", System.currentTimeMillis(), 4);
if (timeout)
throw new IllegalStateException("Timeout in readByte");
return swap32(getInt());
} }
public int read(byte[] packet) throws InterruptedException { public int read(byte[] packet) throws InterruptedException {