Keep an ended link ended, and pin the drop a listener closes over
Mirror / push (push) Successful in 6s
Test / lint (pull_request) Successful in 23s
Test / test (18) (pull_request) Successful in 32s
Test / test (20) (pull_request) Successful in 31s
Test / test (22) (pull_request) Successful in 32s
Test / test (24) (pull_request) Successful in 32s
Test / test (26) (pull_request) Successful in 32s
Mirror / push (push) Successful in 6s
Test / lint (pull_request) Successful in 23s
Test / test (18) (pull_request) Successful in 32s
Test / test (20) (pull_request) Successful in 31s
Test / test (22) (pull_request) Successful in 32s
Test / test (24) (pull_request) Successful in 32s
Test / test (26) (pull_request) Successful in 32s
This commit is contained in:
@@ -1486,6 +1486,9 @@ describe('LinkLife', () => {
|
||||
link.end();
|
||||
|
||||
assert.match((await held).err?.message ?? '', /Session is closed/);
|
||||
link.attach();
|
||||
assert.equal(link.isAttached(), false, 'ended is final');
|
||||
assert.equal(link.end(), false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2458,6 +2461,39 @@ describe('a peer that sends the next segment only once the last one is answered'
|
||||
assert.deepEqual(await peerOf(smpp).close(), {}, 'a group nothing completed is not held');
|
||||
});
|
||||
|
||||
test('reports a drop once as disconnected when a listener closes the session over the segments it lost', async t => {
|
||||
const smpp = await startServer(t);
|
||||
const { session } = await connect(t, smpp, { reconnect: { maxDelay: 100, minDelay: 20 } });
|
||||
|
||||
assert.ok(session);
|
||||
|
||||
const events: string[] = [];
|
||||
const closed = once<true>(resolve => { session.on('close', () => { resolve(true); }); });
|
||||
|
||||
session.on('close', () => { events.push('close'); });
|
||||
session.on('disconnected', () => { events.push('disconnected'); });
|
||||
session.on('sessionError', () => { void session.close(); });
|
||||
|
||||
const [first] = segmentsOf(0x2D);
|
||||
|
||||
assert.ok(first);
|
||||
|
||||
const delivered = await peerOf(smpp).send({
|
||||
cmdName: 'deliver_sm',
|
||||
params: submitSmParams(
|
||||
{ from: '46701113311', message: text, to: '46709771337' },
|
||||
first,
|
||||
{ encoding: 'ASCII', multipart: true },
|
||||
),
|
||||
});
|
||||
|
||||
assert.equal(delivered.err, undefined);
|
||||
await peerOf(smpp).close();
|
||||
await closed;
|
||||
|
||||
assert.deepEqual(events, ['disconnected', 'close']);
|
||||
});
|
||||
|
||||
test('close() still waits for a concatenated message the application has not answered', async t => {
|
||||
const smpp = await startServer(t, { shutdownTimeout: 50 });
|
||||
const incoming = once<Sms>(resolve => {
|
||||
|
||||
Reference in New Issue
Block a user