allow packet zero to be retrieved if it failed as a different number
This commit is contained in:
@@ -127,12 +127,18 @@ export const getFailedPacketIndeces = () => {
|
|||||||
return FAILED_SEQUENCES.filter(isPacketInRange);
|
return FAILED_SEQUENCES.filter(isPacketInRange);
|
||||||
}
|
}
|
||||||
export const getNeededPacketIndeces = () => {
|
export const getNeededPacketIndeces = () => {
|
||||||
if(!isSizeTrusted()) return getFailedPacketIndeces();
|
let packetCount;
|
||||||
const packetCount = countExpectedPackets();
|
if(!isSizeTrusted()) {
|
||||||
|
packetCount = getFailedPacketIndeces().reduce((max, i) => Math.max(max, i));
|
||||||
|
} else {
|
||||||
|
packetCount = countExpectedPackets();
|
||||||
|
}
|
||||||
let indeces = [];
|
let indeces = [];
|
||||||
for(let i = 0; i < packetCount; i++) {
|
for(let i = 0; i < packetCount; i++) {
|
||||||
if(SUCCESS_SEQUENCES.includes(i)) continue;
|
if(SUCCESS_SEQUENCES.includes(i)) continue;
|
||||||
indeces.push(i);
|
indeces.push(i);
|
||||||
|
// cut off in case a failed packet returned a high number
|
||||||
|
if(indeces.length > 20) break;
|
||||||
}
|
}
|
||||||
return indeces;
|
return indeces;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user