Better disconnect - should resolve issues with SSH

This commit is contained in:
Bryan Ashby 2019-02-02 10:20:22 -07:00
parent 43c11dc288
commit 8ba80426e3
3 changed files with 21 additions and 3 deletions

View file

@ -278,13 +278,17 @@ function SSHClient(clientConn) {
});
});
clientConn.on('end', () => {
self.emit('end'); // remove client connection/tracking
clientConn.once('end', () => {
return self.emit('end'); // remove client connection/tracking
});
clientConn.on('error', err => {
self.log.warn( { error : err.message, code : err.code }, 'SSH connection error');
});
this.disconnect = function() {
return clientConn.end();
};
}
util.inherits(SSHClient, baseClient.Client);