Skip to content

Commit

Permalink
Clear connect timer earilest, performance-wise
Browse files Browse the repository at this point in the history
  • Loading branch information
gnought committed Aug 11, 2019
1 parent 527934b commit ad5197d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/handlers/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ var errorMessages = [
]

function handleConnect (client, packet, done) {
clearTimeout(client._connectTimer)
client._connectTimer = null

if (client.broker.preConnect(client) === false) {
return client.conn.destroy()
}
Expand Down Expand Up @@ -69,9 +72,6 @@ function handleConnect (client, packet, done) {
client.clean = packet.clean
client._will = packet.will

clearTimeout(client._connectTimer)
client._connectTimer = null

client.broker._series(
new ClientPacketStatus(client, packet),
connectActions,
Expand Down

0 comments on commit ad5197d

Please sign in to comment.