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:
2026-09-05 21:00:52 +02:00
committed by GitHub
parent fec4fda082
commit ea42bc6d20
11 changed files with 511 additions and 141 deletions
+3 -4
View File
@@ -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;