Skip to content

Commit

Permalink
Fixed enqueueOffline to use packet arg
Browse files Browse the repository at this point in the history
  • Loading branch information
gnought committed Aug 11, 2019
1 parent e1d0ddb commit 6b76ac2
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions aedes.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@ function enqueueOffline (packet, done) {
var enqueuer = this.broker._enqueuers.get()

enqueuer.complete = done
enqueuer.status = this
enqueuer.packet = packet
enqueuer.topic = packet.topic

enqueuer.broker = this.broker
this.broker.persistence.subscriptionsByTopic(
packet.topic,
enqueuer.done
Expand All @@ -167,35 +167,36 @@ function enqueueOffline (packet, done) {

function DoEnqueues () {
this.next = null
this.status = null
this.complete = null
this.packet = null
this.topic = null
this.broker = null

var that = this

this.done = function doneEnqueue (err, subs) {
var status = that.status
var broker = status.broker
var broker = that.broker

if (err) {
// is this really recoverable?
// let's just error the whole aedes
broker.emit('error', err)
} else {
var complete = that.complete
return
}

if (that.topic.indexOf('$SYS') === 0) {
subs = subs.filter(removeSharp)
}
if (that.topic.indexOf('$SYS') === 0) {
subs = subs.filter(removeSharp)
}

that.status = null
that.complete = null
that.topic = null
var packet = that.packet
var complete = that.complete

broker.persistence.outgoingEnqueueCombi(subs, status.packet, complete)
that.packet = null
that.complete = null
that.topic = null

broker._enqueuers.release(that)
}
broker.persistence.outgoingEnqueueCombi(subs, packet, complete)
broker._enqueuers.release(that)
}
}

Expand Down

0 comments on commit 6b76ac2

Please sign in to comment.