Stop keepalive when "close" event triggers on TCP socket.

develop
Icedream 2016-04-09 17:04:16 +02:00
parent 6a68d5c2e8
commit 3538060002
1 changed files with 3 additions and 1 deletions

View File

@ -108,7 +108,9 @@ module.exports = class TS3ClientQuery extends EventEmitter
connect: (cb) =>
@_tcpClient = new net.Socket
@_tcpClient.on "close", () => @emit "close"
@_tcpClient.on "close", () =>
@_stopKeepalive()
@emit "close"
@_tcpClient.on "error", (err) =>
@_log.warn "Connection error", err
@_stopKeepalive()