Skip to content

Commit

Permalink
Optimize handle fn again
Browse files Browse the repository at this point in the history
  • Loading branch information
gnought committed Aug 11, 2019
1 parent f6f71e7 commit 18cce09
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/handlers/index.js
Expand Up @@ -19,10 +19,6 @@ function handle (client, packet, done) {
return client.conn.destroy()
}

if (client._keepaliveInterval > 0) {
client._keepaliveTimer.reschedule(client._keepaliveInterval)
}

switch (packet.cmd) {
case 'publish':
handlePublish(client, packet, done)
Expand All @@ -49,9 +45,14 @@ function handle (client, packet, done) {
case 'disconnect':
client.disconnected = true
client.conn.end()
break
return
default:
client.conn.destroy()
return
}

if (client._keepaliveInterval > 0) {
client._keepaliveTimer.reschedule(client._keepaliveInterval)
}
}

Expand Down

0 comments on commit 18cce09

Please sign in to comment.