Console should get much smarter around compatibility with older units #6845

only:now with ochBlockSize
This commit is contained in:
rusefillc 2024-09-07 21:58:54 -04:00
parent 829d6d39b3
commit 17a35f07d4
3 changed files with 10 additions and 2 deletions

View File

@ -15,6 +15,7 @@ public class IniFileMetaInfo {
private int totalSize;
private final List<Integer> pageSizes = new ArrayList<>();
private int ochBlockSize;
/**
* read maximum chunk size
@ -24,6 +25,7 @@ public class IniFileMetaInfo {
public IniFileMetaInfo(RawIniFile file) {
nPages = file.getSimpleIntegerProperty("nPages", 1);
ochBlockSize = file.getSimpleIntegerProperty("ochBlockSize");
blockingFactor = file.getSimpleIntegerProperty("blockingFactor", DEFAULT_BLOCKING_FACTOR);
@ -47,6 +49,10 @@ public class IniFileMetaInfo {
return nPages;
}
public int getOchBlockSize() {
return ochBlockSize;
}
public int getBlockingFactor() {
return blockingFactor;
}

View File

@ -93,6 +93,7 @@ public class IniFileReaderTest {
String string = " nPages = 3\n" +
SIGNATURE_UNIT_TEST +
PAGE_READ +
"ochBlockSize=1\n" +
" pageSize = 288, 64, 288\n";

View File

@ -625,11 +625,12 @@ public class BinaryProtocol {
// TODO: Get rid of the +1. This adds a byte at the front to tack a fake TS response code on the front
// of the reassembled packet.
byte[] reassemblyBuffer = new byte[TS_TOTAL_OUTPUT_SIZE + 1];
int ochBlockSize = iniFile.getMetaInfo().getOchBlockSize();
byte[] reassemblyBuffer = new byte[ochBlockSize + 1];
reassemblyBuffer[0] = Integration.TS_RESPONSE_OK;
int reassemblyIdx = 0;
int remaining = TS_TOTAL_OUTPUT_SIZE;
int remaining = ochBlockSize;
while (remaining > 0) {
// If less than one full chunk left, do a smaller read