Skip to content

Commit

Permalink
do not subscribe closed clients
Browse files Browse the repository at this point in the history
  • Loading branch information
Uladzimir Danko committed Aug 25, 2024
1 parent 9c93183 commit a191366
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/handlers/subscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ function addSubs (sub, done) {
func = blockDollarSignTopics(func)
}

if (client.closed || client.broker.closed) {
// a hack, sometimes client.close() or broker.close() happened
// before authenticate() comes back
// we don't continue subscription here
return
}

if (!client.subscriptions[topic]) {
client.subscriptions[topic] = new Subscription(qos, func, rh, rap, nl)
broker.subscribe(topic, func, done)
Expand Down

0 comments on commit a191366

Please sign in to comment.