Skip to content

Commit 7af8400

Browse files
committed
Do not stop CQN notifications that were not started
1 parent 037c817 commit 7af8400

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

src/njsSubscription.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,12 +442,15 @@ bool njsSubscription_startNotifications(njsSubscription *subscr,
442442
// subscription is deregistered, either directly via a call to unsubscribe()
443443
// or indirectly via the timeout attribute or the quality of service flag that
444444
// tells a subscription to deregister after the first notification has been
445-
// received.
445+
// received. If notifications were never started (due to an error of some kind)
446+
// nothing needs to be done at this point.
446447
//-----------------------------------------------------------------------------
447448
bool njsSubscription_stopNotifications(njsSubscription *subscr)
448449
{
449-
uv_close((uv_handle_t*) &subscr->async,
450-
njsSubscription_onStopNotifications);
450+
if (subscr->name) {
451+
uv_close((uv_handle_t*) &subscr->async,
452+
njsSubscription_onStopNotifications);
453+
}
451454
return true;
452455
}
453456

test/runCQN.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ describe('185. runCQN.js', function() {
433433
}); // 185.8
434434

435435
// An variation of 185.4
436-
it.skip('185.9 Negative - unsubscribe the invalid subscription', async () => {
436+
it('185.9 Negative - unsubscribe the invalid subscription', async () => {
437437
try {
438438
const TABLE = 'nodb_tab_cqn_9';
439439
const myCallback = async function(message) {
@@ -456,11 +456,11 @@ describe('185. runCQN.js', function() {
456456
);
457457
// DPI-1013: not supported
458458

459-
conn.unsubscribe('sub9');
459+
await conn.unsubscribe('sub9');
460460

461461
} catch (err) {
462462
should.not.exist(err);
463463
}
464464
}); // 185.9
465465

466-
});
466+
});

0 commit comments

Comments
 (0)