Give the dumbclient peers a namespace owner that outlives them, count window 2000's throttled messages, and correct what the findings blamed on the peer
Mirror / push (push) Successful in 4s
Test / lint (pull_request) Successful in 23s
Test / test (18) (pull_request) Successful in 31s
Test / test (20) (pull_request) Successful in 31s
Test / test (22) (pull_request) Successful in 32s
Test / test (24) (pull_request) Successful in 30s
Test / test (26) (pull_request) Successful in 31s

This commit is contained in:
2026-09-26 14:37:20 +02:00
parent 855ccbe75f
commit fb6b125aab
7 changed files with 98 additions and 101 deletions
+14 -7
View File
@@ -24,7 +24,7 @@ import { Session } from '../src/session.ts';
import { DlrMerger } from '../src/dlr-merger.ts';
import { PduRefusedError } from '../src/pdu-refusal.ts';
import { objToPdu } from '../src/pdu.ts';
import { checkSessionOptions, standsInFor } from '../src/session-options.ts';
import { checkSessionOptions, defaults, standsInFor } from '../src/session-options.ts';
import { client } from '../src/client.ts';
import { closeAfter, closeListenerAfter } from './teardown.ts';
import { concatOf } from '../src/concat.ts';
@@ -1537,26 +1537,33 @@ describe('held message bounds', () => {
session,
});
const answers: (ErrorName | undefined)[] = [];
let messages = 0;
const received: Sms[] = [];
session.sendReturn = (_pdu, status) => {
answers.push(status);
return Promise.resolve({});
};
session.on('sms', () => { messages++; });
session.on('sms', sms => { received.push(sms); });
for (let seqNr = 1; seqNr <= 1000; seqNr++) {
for (let seqNr = 1; seqNr <= defaults.maxHeldMessages; seqNr++) {
await incoming.handle(submitPdu(seqNr));
}
assert.equal(messages, 1000);
assert.equal(received.length, defaults.maxHeldMessages);
await incoming.handle(submitPdu(1001));
await incoming.handle(submitPdu(defaults.maxHeldMessages + 1));
await incoming.handle(segment(7, 1, 2));
assert.equal(messages, 1000);
assert.equal(received.length, defaults.maxHeldMessages);
assert.deepEqual(answers, ['ESME_RTHROTTLED', 'ESME_RTHROTTLED']);
// The refused first segment joined no group, so the second one completes nothing.
await received[0]?.sendResp();
await delay(0);
await incoming.handle(segment(7, 2, 2));
assert.equal(received.length, defaults.maxHeldMessages);
incoming.clear();
});