1
1
mirror of https://github.com/leon-ai/leon.git synced 2025-01-04 15:55:58 +03:00

fix(server): reset connection state and connection counter

This commit is contained in:
louistiti 2022-11-12 23:09:22 +08:00
parent 862112ed5f
commit 3d9d9496b7
No known key found for this signature in database
GPG Key ID: 7ECA3DD523793FE6

View File

@ -44,6 +44,7 @@ class TCPClient {
`Connected to the TCP server tcp://${this.host}:${this.port}`
)
this.reconnectCounter = 0
this.isConnected = true
this.ee.emit('connected', null)
})
@ -87,11 +88,15 @@ class TCPClient {
} else {
LogHelper.error(`Failed to connect to the TCP server: ${err}`)
}
this.isConnected = false
})
this.tcpSocket.on('end', () => {
LogHelper.title('TCP Client')
LogHelper.success('Disconnected from the TCP server')
this.isConnected = false
})
}