Skip to content

Commit

Permalink
Fixed glitch in keepaliveInterval
Browse files Browse the repository at this point in the history
It used to: disconnect after 1501 * keepalive time
It now: disconnects after 1500 * keepalive time + 1 millisecond

This solves issues with large keepalive numbers sent with the connect packet.
  • Loading branch information
wuhkuh committed Oct 20, 2016
1 parent 285dd87 commit 052a6e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/handlers/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function handleConnect (client, packet, done) {
client._connectTimer = null

if (packet.keepalive > 0) {
client._keepaliveInterval = packet.keepalive * 1501
client._keepaliveInterval = packet.keepalive * 1500 + 1
client._keepaliveTimer = retimer(function keepaliveTimeout () {
client.broker.emit('keepaliveTimeout', client)
client.emit('error', new Error('keep alive timeout'))
Expand Down

0 comments on commit 052a6e9

Please sign in to comment.