diff --git a/src/njsSubscription.c b/src/njsSubscription.c index 4c6cb2f3..a826e648 100644 --- a/src/njsSubscription.c +++ b/src/njsSubscription.c @@ -442,12 +442,15 @@ bool njsSubscription_startNotifications(njsSubscription *subscr, // subscription is deregistered, either directly via a call to unsubscribe() // or indirectly via the timeout attribute or the quality of service flag that // tells a subscription to deregister after the first notification has been -// received. +// received. If notifications were never started (due to an error of some kind) +// nothing needs to be done at this point. //----------------------------------------------------------------------------- bool njsSubscription_stopNotifications(njsSubscription *subscr) { - uv_close((uv_handle_t*) &subscr->async, - njsSubscription_onStopNotifications); + if (subscr->name) { + uv_close((uv_handle_t*) &subscr->async, + njsSubscription_onStopNotifications); + } return true; } diff --git a/test/runCQN.js b/test/runCQN.js index f357e00b..d61844d6 100644 --- a/test/runCQN.js +++ b/test/runCQN.js @@ -433,7 +433,7 @@ describe('185. runCQN.js', function() { }); // 185.8 // An variation of 185.4 - it.skip('185.9 Negative - unsubscribe the invalid subscription', async () => { + it('185.9 Negative - unsubscribe the invalid subscription', async () => { try { const TABLE = 'nodb_tab_cqn_9'; const myCallback = async function(message) { @@ -456,11 +456,11 @@ describe('185. runCQN.js', function() { ); // DPI-1013: not supported - conn.unsubscribe('sub9'); + await conn.unsubscribe('sub9'); } catch (err) { should.not.exist(err); } }); // 185.9 -}); \ No newline at end of file +});