Tie the refusal to the link, not to the hold, so a released message is refused too

This commit is contained in:
2026-09-01 20:25:57 +02:00
parent 82a95593bd
commit c8d265d5fa
10 changed files with 61 additions and 54 deletions
+2 -3
View File
@@ -54,7 +54,6 @@ export type SmsInput = {
/** What the session's incoming side gives a message so it can be answered and accounted for. */
export type SmsHandlers = {
/** Whether the link this message arrived on is gone, so no answer of ours correlates. */
lostLink: () => boolean;
onAnswered: () => void;
send: (input: PduObjectInput) => Promise<Result<{ pduObj: PduObject }>>;
@@ -107,13 +106,13 @@ async function sendResp(
return { err: new Error('smsId must not be empty') };
}
if (options.smsId !== undefined) answered.smsId = options.smsId;
// A response carries the sequence number it was asked on, which the next link knows nothing about.
if (lostLink()) {
return { err: new Error('The link this message arrived on is gone, so nothing would correlate the response') };
}
if (options.smsId !== undefined) answered.smsId = options.smsId;
const results = await Promise.all(sms.pduObjs.map((pduObj, index) => sms.session.sendReturn(
pduObj,
options.status ?? 'ESME_ROK',