Put a receipt's segments on the wire together, like a message's

This commit is contained in:
2026-09-01 17:03:33 +02:00
parent 8becbc0ab6
commit 1e7e113bd7
7 changed files with 56 additions and 23 deletions
+9 -6
View File
@@ -138,11 +138,11 @@ async function sendDlr(
}
const total = sms.pduObjs.length;
const pduObjs: PduObject[] = [];
for (let index = 0; index < total; index++) {
// Together, not one after a response: a drain waiting for this message must see the whole receipt.
const sent = await Promise.all(sms.pduObjs.map((_segment, index) => {
const smsId = segmentId(sms.smsId, index, total);
const sent = await send({
return send({
cmdName: 'deliver_sm',
params: {
destination_addr: sms.from,
@@ -152,10 +152,13 @@ async function sendDlr(
},
...(sms.session.acceptsOptionalParams() ? { tlvs: receiptTlvs(smsId, status) } : {}),
});
}));
const pduObjs: PduObject[] = [];
if (sent.err) return { err: sent.err };
for (const one of sent) {
if (one.err) return { err: one.err };
pduObjs.push(sent.pduObj);
pduObjs.push(one.pduObj);
}
return { pduObjs };