Start sending keep-alives only after we're actually connected.

develop
Icedream 2016-04-09 17:06:57 +02:00
parent e2a05f73bf
commit e45aa93b36
1 changed files with 4 additions and 3 deletions

View File

@ -121,6 +121,10 @@ module.exports = class TS3ClientQuery extends EventEmitter
@_tcpClient.connect @_port, @_host, () =>
@emit "open"
await @once "message.selected", defer(selectedArgs)
# send keepalives to avoid connection timeout
@_resetKeepalive()
cb?()
splitterStream = StreamSplitter("\n\r")
@ -143,9 +147,6 @@ module.exports = class TS3ClientQuery extends EventEmitter
else
@emit "vars", response.args
# send keepalives to avoid connection timeout
@_resetKeepalive()
_sendKeepalive: (cb) =>
@_log.silly "Send: <keep-alive>"