Skip to content

Commit

Permalink
Split return in favour of V8 optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
gnought committed Aug 17, 2019
1 parent 83371d8 commit 0f159f7
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/client.js
Expand Up @@ -48,7 +48,8 @@ function Client (broker, conn) {

function nextBatch (err) {
if (err) {
return that.emit('error', err)
that.emit('error', err)
return
}

var buf = empty
Expand Down
6 changes: 4 additions & 2 deletions lib/handlers/connect.js
Expand Up @@ -151,11 +151,12 @@ function setKeepAlive (arg, done) {
function fetchSubs (arg, done) {
var client = this.client
if (!this.packet.clean) {
return client.broker.persistence.subscriptionsByClient({
client.broker.persistence.subscriptionsByClient({
id: client.id,
done: done,
arg: arg
}, gotSubs)
return
}
arg.sessionPresent = false // [MQTT-3.2.2-1]
client.broker.persistence.cleanSubscriptions(
Expand Down Expand Up @@ -185,10 +186,11 @@ function storeWill (arg, done) {
var client = this.client
client.will = client._will
if (client.will) {
return client.broker.persistence.putWill(
client.broker.persistence.putWill(
client,
client.will,
done)
return
}
done()
}
Expand Down
3 changes: 2 additions & 1 deletion lib/handlers/index.js
Expand Up @@ -16,7 +16,8 @@ function handle (client, packet, done) {
client.conn.destroy()
return done(new Error('invalid protocol'))
}
return handleConnect(client, packet, done)
handleConnect(client, packet, done)
return
}
if (!client.connected) {
// [MQTT-3.1.0-1]
Expand Down
3 changes: 2 additions & 1 deletion lib/handlers/pubrec.js
Expand Up @@ -21,7 +21,8 @@ function handlePubrec (client, packet, done) {
function reply (err) {
if (err) {
// TODO is this ok?
return client._onError(err)
client._onError(err)
return
}

write(client, pubrel, done)
Expand Down
3 changes: 2 additions & 1 deletion lib/handlers/unsubscribe.js
Expand Up @@ -65,7 +65,8 @@ function completeUnsubscribe (err) {
var done = this.finish

if (err) {
return client.emit('error', err)
client.emit('error', err)
return
}

if ((!packet.close || client.clean === true) && packet.unsubscriptions.length > 0) {
Expand Down

0 comments on commit 0f159f7

Please sign in to comment.