Cover the enquire_link we answer and stop draining a peer that answers nothing
This commit is contained in:
@@ -161,8 +161,9 @@ exactly 140.
|
||||
listener; anything else takes a bare `t.after`. Its close aborts rather than drains, so a test that
|
||||
fails holding the send window still ends.
|
||||
- `t.after` hooks run in registration order, so registering at creation tears the outermost resource
|
||||
down first — the wrong way round for a listener, which blocks until every connection on it is gone.
|
||||
A listener's own hook goes last, after the hooks that close what is connected to it.
|
||||
down first. A teardown that waits on a listener must destroy that listener's own connections before
|
||||
it waits, or be registered after the hook that does — `net.Server.close()` does not call back until
|
||||
every connection on it is gone.
|
||||
- `assert.equal` from `node:assert/strict` narrows its first argument, so a following `?.` on the
|
||||
same value is flagged as unnecessary. Assert once with `assert.ok(x)` and use plain access after.
|
||||
|
||||
|
||||
+17
-4
@@ -298,6 +298,21 @@ describe('bind', () => {
|
||||
assert.equal(await responded, '00000010800000150000000400000001');
|
||||
});
|
||||
|
||||
test('answers the enquire_link a bound peer sends', async t => {
|
||||
const smpp = await startServer(t);
|
||||
const peer = rawPeer(t, smpp.port);
|
||||
|
||||
peer.write(bindOf(0x34));
|
||||
await peer.next();
|
||||
peer.write({ cmdName: 'enquire_link', seqNr: 2 });
|
||||
|
||||
const answered = await peer.next();
|
||||
|
||||
assert.equal(answered.cmdName, 'enquire_link_resp');
|
||||
assert.equal(answered.cmdStatus, 'ESME_ROK');
|
||||
assert.equal(answered.seqNr, 2);
|
||||
});
|
||||
|
||||
test('declares SMPP 3.4 by default and the version the caller asks for', async t => {
|
||||
const smpp = await startServer(t);
|
||||
const declared: (number | undefined)[] = [];
|
||||
@@ -1094,7 +1109,8 @@ describe('robustness', () => {
|
||||
|
||||
assert.ok(session);
|
||||
|
||||
const held = session.sendSms({ from: '46701113311', message: 'holds the slot', to: '46709771337' });
|
||||
void session.sendSms({ from: '46701113311', message: 'holds the slot', to: '46709771337' });
|
||||
|
||||
const controller = new AbortController();
|
||||
|
||||
controller.abort();
|
||||
@@ -1107,9 +1123,6 @@ describe('robustness', () => {
|
||||
|
||||
assert.notEqual(aborted, false, 'an aborted send should not wait for the window');
|
||||
assert.ok(aborted !== false && aborted.err instanceof Error);
|
||||
|
||||
await session.close();
|
||||
await held;
|
||||
});
|
||||
|
||||
// A socket the loop opened and never handed over is one leaked per retry, forever.
|
||||
|
||||
Reference in New Issue
Block a user