ipc: prevent some more errors

This commit is contained in:
jean-emmanuel 2018-02-17 13:47:04 +01:00
parent 01e12ac4ab
commit 03ea75857c
2 changed files with 4 additions and 0 deletions

View file

@ -52,6 +52,7 @@ class Ipc extends EventEmitter {
this.reconnect = clearInterval(this.reconnect)
this.hearbeat = setInterval(()=>{
if (!this.connected()) return
this.socket.send(`["ping"]`)
this.hearbeatTimeout = setTimeout(()=>{
if (this.connected()) this.socket.close()
@ -79,6 +80,7 @@ class Ipc extends EventEmitter {
this.hearbeat = clearInterval(this.hearbeat)
this.hearbeatTimeout = clearTimeout(this.hearbeatTimeout)
this.dieTimeout = clearTimeout(this.dieTimeout)
if (!this.reconnect) {
this.reconnect = setInterval(()=>{