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