fixing build - adjusting some strange code to smaller blocking factor

This commit is contained in:
rusefi 2020-08-21 14:53:33 -04:00
parent 70cdb8da85
commit 68ece00b0e
3 changed files with 3 additions and 9 deletions

View File

@ -322,7 +322,7 @@ public class BinaryProtocol implements BinaryProtocolCommands {
setController(newVersion); setController(newVersion);
} }
private byte[] receivePacket(String msg, boolean allowLongResponse) throws EOFException { private byte[] receivePacket(String msg, boolean allowLongResponse) throws IOException {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
synchronized (ioLock) { synchronized (ioLock) {
return incomingData.getPacket(msg, allowLongResponse, start); return incomingData.getPacket(msg, allowLongResponse, start);
@ -465,12 +465,6 @@ public class BinaryProtocol implements BinaryProtocolCommands {
} }
public void writeData(byte[] content, Integer offset, int size) { public void writeData(byte[] content, Integer offset, int size) {
if (size > Fields.BLOCKING_FACTOR) {
writeData(content, offset, Fields.BLOCKING_FACTOR);
writeData(content, offset + Fields.BLOCKING_FACTOR, size - Fields.BLOCKING_FACTOR);
return;
}
isBurnPending = true; isBurnPending = true;
byte packet[] = new byte[5 + size]; byte packet[] = new byte[5 + size];

View File

@ -69,7 +69,7 @@ public class IncomingDataBuffer {
if (packetSize < 0) if (packetSize < 0)
return null; return null;
if (!allowLongResponse && packetSize > Math.max(Fields.BLOCKING_FACTOR, Fields.TS_OUTPUT_SIZE) + 10) if (!allowLongResponse && packetSize > Math.max(Fields.BLOCKING_FACTOR, Fields.TS_OUTPUT_SIZE) + 10)
return null; throw new IllegalArgumentException(packetSize + " packet while not allowLongResponse");
isTimeout = waitForBytes(loggingPrefix + msg + " body", start, packetSize + 4); isTimeout = waitForBytes(loggingPrefix + msg + " body", start, packetSize + 4);
if (isTimeout) if (isTimeout)

View File

@ -25,7 +25,7 @@ public class HelloCommand implements Command {
@Nullable @Nullable
public static String getHelloResponse(IncomingDataBuffer incomingData) throws EOFException { public static String getHelloResponse(IncomingDataBuffer incomingData) throws EOFException {
byte[] response = incomingData.getPacket("[hello]"); byte[] response = incomingData.getPacket("[hello]", true);
if (!checkResponseCode(response, BinaryProtocolCommands.RESPONSE_OK)) if (!checkResponseCode(response, BinaryProtocolCommands.RESPONSE_OK))
return null; return null;
return new String(response, 1, response.length - 1); return new String(response, 1, response.length - 1);