Register the raw peer's teardown, and keep the changelog line to what changed
Mirror / push (push) Successful in 6s
Test / lint (pull_request) Successful in 21s
Test / test (18) (pull_request) Successful in 35s
Test / test (20) (pull_request) Successful in 30s
Test / test (22) (pull_request) Successful in 30s
Test / test (24) (pull_request) Successful in 31s
Test / test (26) (pull_request) Successful in 31s
Mirror / push (push) Successful in 6s
Test / lint (pull_request) Successful in 21s
Test / test (18) (pull_request) Successful in 35s
Test / test (20) (pull_request) Successful in 30s
Test / test (22) (pull_request) Successful in 30s
Test / test (24) (pull_request) Successful in 31s
Test / test (26) (pull_request) Successful in 31s
This commit is contained in:
+1
-1
@@ -34,7 +34,7 @@
|
|||||||
name a refused `NaN` too, where the refusal used to read `null`.
|
name a refused `NaN` too, where the refusal used to read `null`.
|
||||||
- An `alert_notification` or an `outbind` from the peer is logged and left unanswered, as SMPP 3.4
|
- An `alert_notification` or an `outbind` from the peer is logged and left unanswered, as SMPP 3.4
|
||||||
gives neither a response. Each one used to emit `sessionError`, `"alert_notification" has no
|
gives neither a response. Each one used to emit `sessionError`, `"alert_notification" has no
|
||||||
response command`, and a server did the same for an `outbind` before bind.
|
response command`.
|
||||||
|
|
||||||
## 0.5.0
|
## 0.5.0
|
||||||
|
|
||||||
|
|||||||
+32
-31
@@ -322,19 +322,16 @@ describe('bind', () => {
|
|||||||
|
|
||||||
smpp.on('session', session => { session.on('sessionError', err => { errors.push(err); }); });
|
smpp.on('session', session => { session.on('sessionError', err => { errors.push(err); }); });
|
||||||
|
|
||||||
const responded = once<string>(resolve => {
|
const peer = rawPeer(t, smpp.port);
|
||||||
const sock = net.connect({ port: smpp.port }, () => {
|
|
||||||
sock.write(pduBytes({ cmdName: 'outbind', params: { password: 'pass', system_id: 'smsc' }, seqNr: 1 }));
|
|
||||||
sock.write(Buffer.from('00000010000000150000000000000002', 'hex'));
|
|
||||||
});
|
|
||||||
|
|
||||||
sock.on('data', data => {
|
peer.write({ cmdName: 'outbind', params: { password: 'pass', system_id: 'smsc' }, seqNr: 1 });
|
||||||
sock.destroy();
|
peer.write({ cmdName: 'enquire_link', seqNr: 2 });
|
||||||
resolve(data.toString('hex'));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
assert.equal(await responded, '00000010800000150000000400000002');
|
const answered = await raceWithin(2000, peer.next());
|
||||||
|
|
||||||
|
assert.ok(answered, 'the peer was never answered');
|
||||||
|
assert.equal(answered.cmdStatus, 'ESME_RINVBNDSTS');
|
||||||
|
assert.equal(answered.seqNr, 2);
|
||||||
assert.deepEqual(errors, []);
|
assert.deepEqual(errors, []);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1529,6 +1526,30 @@ describe('robustness', () => {
|
|||||||
assert.ok(Date.now() - started < 5000, 'should have given up quickly');
|
assert.ok(Date.now() - started < 5000, 'should have given up quickly');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('leaves an alert_notification and an outbind unanswered, since SMPP names no response', async t => {
|
||||||
|
const peer = await smscPeer(t);
|
||||||
|
const { session } = await client({ port: peer.port });
|
||||||
|
const errors: Error[] = [];
|
||||||
|
|
||||||
|
assert.ok(session);
|
||||||
|
closeAfter(t, session);
|
||||||
|
session.on('sessionError', err => { errors.push(err); });
|
||||||
|
peer.writeRaw(pduBytes({
|
||||||
|
cmdName: 'alert_notification',
|
||||||
|
params: { esme_addr: '46709771337', source_addr: '46701113311' },
|
||||||
|
seqNr: 10,
|
||||||
|
}));
|
||||||
|
peer.writeRaw(pduBytes({ cmdName: 'outbind', params: { password: 'pass', system_id: 'smsc' }, seqNr: 11 }));
|
||||||
|
peer.writeRaw(pduBytes({ cmdName: 'enquire_link', seqNr: 12 }));
|
||||||
|
|
||||||
|
const answered = await raceWithin(2000, peer.next());
|
||||||
|
|
||||||
|
assert.ok(answered, 'the peer was never answered');
|
||||||
|
assert.equal(answered.cmdName, 'enquire_link_resp');
|
||||||
|
assert.equal(answered.seqNr, 12);
|
||||||
|
assert.deepEqual(errors, []);
|
||||||
|
});
|
||||||
|
|
||||||
test('stops a connection attempt on an aborted signal', async () => {
|
test('stops a connection attempt on an aborted signal', async () => {
|
||||||
const controller = new AbortController();
|
const controller = new AbortController();
|
||||||
|
|
||||||
@@ -1814,26 +1835,6 @@ describe('a PDU the codec cannot read', () => {
|
|||||||
assert.ok((await raceWithin(2000, failed)) instanceof Error, 'one sessionError per refused PDU');
|
assert.ok((await raceWithin(2000, failed)) instanceof Error, 'one sessionError per refused PDU');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('leaves an alert_notification and an outbind unanswered, since SMPP names no response', async t => {
|
|
||||||
const { peer, session } = await bound(t);
|
|
||||||
const errors: Error[] = [];
|
|
||||||
|
|
||||||
session.on('sessionError', err => { errors.push(err); });
|
|
||||||
peer.writeRaw(pduBytes({
|
|
||||||
cmdName: 'alert_notification',
|
|
||||||
params: { esme_addr: '46709771337', source_addr: '46701113311' },
|
|
||||||
seqNr: 10,
|
|
||||||
}));
|
|
||||||
peer.writeRaw(pduBytes({ cmdName: 'outbind', params: { password: 'pass', system_id: 'smsc' }, seqNr: 11 }));
|
|
||||||
peer.writeRaw(pduBytes({ cmdName: 'enquire_link', seqNr: 12 }));
|
|
||||||
|
|
||||||
const answered = await answerTo(peer);
|
|
||||||
|
|
||||||
assert.equal(answered.cmdName, 'enquire_link_resp');
|
|
||||||
assert.equal(answered.seqNr, 12);
|
|
||||||
assert.deepEqual(errors, []);
|
|
||||||
});
|
|
||||||
|
|
||||||
test('answers a deliver_sm with a truncated TLV stream with ESME_RINVTLVSTREAM', async t => {
|
test('answers a deliver_sm with a truncated TLV stream with ESME_RINVTLVSTREAM', async t => {
|
||||||
const { peer, session } = await bound(t);
|
const { peer, session } = await bound(t);
|
||||||
let reports = 0;
|
let reports = 0;
|
||||||
|
|||||||
@@ -409,6 +409,11 @@ and is also what the panel ranked hardest — two methods, one answer.
|
|||||||
|
|
||||||
## Worth doing, not blocking
|
## Worth doing, not blocking
|
||||||
|
|
||||||
|
- [ ] **Decide whether `alert_notification` reaches the application as more than `incomingPduObj`.**
|
||||||
|
It is the SMSC saying a handset it could not reach is reachable again (`esme_addr`,
|
||||||
|
`ms_availability_status`); a client has no `onRequest`, so the raw PDU event is the only way in.
|
||||||
|
Raised by the stability review of #21.
|
||||||
|
|
||||||
- [ ] **Cut the three teardown sentences `test/teardown.ts` already says.** Under AGENTS.md's
|
- [ ] **Cut the three teardown sentences `test/teardown.ts` already says.** Under AGENTS.md's
|
||||||
Conventions, "`test/teardown.ts` covers a session, a server and a listener" restates its two
|
Conventions, "`test/teardown.ts` covers a session, a server and a listener" restates its two
|
||||||
exported names, "Its close aborts rather than drains" restates `closeAfter`'s own doc comment,
|
exported names, "Its close aborts rather than drains" restates `closeAfter`'s own doc comment,
|
||||||
|
|||||||
Reference in New Issue
Block a user