Refuse a single unreadable PDU instead of the whole link (#79)
* Regression tests: a PDU the codec cannot read costs that PDU, not the link * Refuse a single unreadable PDU instead of the whole link * smscsim interop asserts the first attempt gets every DLR * Record the smscsim sequence number defect as fixed * One framing rule and one response-command lookup, per the architecture review * Apply the stability review's nits: honest sessionError docs and one link-survives assertion
This commit is contained in:
+3
-4
@@ -1,5 +1,5 @@
|
||||
import type { Result } from './result.ts';
|
||||
import { maxPduLength } from './pdu.ts';
|
||||
import { framingRefusal } from './pdu.ts';
|
||||
|
||||
/**
|
||||
* Cuts a byte stream into whole PDUs.
|
||||
@@ -31,10 +31,9 @@ export class PduFramer {
|
||||
|
||||
while (this.length >= 16) {
|
||||
const cmdLength = this.join(16).readUInt32BE(0);
|
||||
const unframable = framingRefusal(cmdLength);
|
||||
|
||||
if (cmdLength < 16 || cmdLength > maxPduLength) {
|
||||
return { err: new Error(`Refusing a cmd_length of ${String(cmdLength)}`) };
|
||||
}
|
||||
if (unframable) return { err: unframable };
|
||||
|
||||
if (this.length < cmdLength) break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user