This commit is contained in:
rusefillc 2022-02-10 23:17:42 -05:00
parent 13fd96165d
commit 6241b696f2
2 changed files with 3 additions and 2 deletions

View File

@ -89,9 +89,10 @@ void TsChannelBase::writeCrcPacket(uint8_t responseCode, const uint8_t* buf, siz
} }
if (size <= BLOCKING_FACTOR + 7) { if (size <= BLOCKING_FACTOR + 7) {
// small packets use small packet optimization // for small packets we use a buffer for CRC calculation
writeCrcPacketSmall(responseCode, buf, size); writeCrcPacketSmall(responseCode, buf, size);
} else { } else {
// for larger packets we do not use a buffer for CRC calculation meaning data is now allowed to modify while pending
writeCrcPacketLarge(responseCode, buf, size); writeCrcPacketLarge(responseCode, buf, size);
} }
} }

View File

@ -66,7 +66,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)
throw new IllegalArgumentException(packetSize + " packet while not allowLongResponse"); throw new IllegalArgumentException(packetSize + " packet while not allowLongResponse"); // this is about CRC calculation and mutable buffers on firmware side
isTimeout = waitForBytes(loggingPrefix + msg + " body", start, packetSize + 4); isTimeout = waitForBytes(loggingPrefix + msg + " body", start, packetSize + 4);
if (isTimeout) if (isTimeout)