proxy progress
This commit is contained in:
parent
af270cd164
commit
de9fc7ea43
|
@ -155,6 +155,13 @@ public class IncomingDataBuffer {
|
|||
return swap32(getInt());
|
||||
}
|
||||
|
||||
public short readShort() throws EOFException, InterruptedException {
|
||||
boolean timeout = waitForBytes("readShort", System.currentTimeMillis(), 2);
|
||||
if (timeout)
|
||||
throw new IllegalStateException("Timeout in readShort");
|
||||
return (short) swap16(getShort());
|
||||
}
|
||||
|
||||
public int read(byte[] packet) throws InterruptedException {
|
||||
boolean timeout = waitForBytes("read", System.currentTimeMillis(), packet.length);
|
||||
if (timeout)
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.rusefi.binaryprotocol.BinaryProtocol;
|
|||
import com.rusefi.binaryprotocol.IncomingDataBuffer;
|
||||
import com.rusefi.binaryprotocol.IoHelper;
|
||||
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
|
@ -51,4 +52,8 @@ public interface IoStream extends WriteStream {
|
|||
void close();
|
||||
|
||||
IncomingDataBuffer getDataBuffer();
|
||||
|
||||
default short readShort() throws EOFException, InterruptedException {
|
||||
return getDataBuffer().readShort();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue