mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-06-07 13:15:28 +02:00
Better disconnect - should resolve issues with SSH
This commit is contained in:
parent
43c11dc288
commit
8ba80426e3
3 changed files with 21 additions and 3 deletions
|
@ -511,7 +511,12 @@ Client.prototype.end = function () {
|
||||||
//
|
//
|
||||||
// We can end up calling 'end' before TTY/etc. is established, e.g. with SSH
|
// We can end up calling 'end' before TTY/etc. is established, e.g. with SSH
|
||||||
//
|
//
|
||||||
|
if(_.isFunction(this.disconnect)) {
|
||||||
|
return this.disconnect();
|
||||||
|
} else {
|
||||||
|
// legacy fallback
|
||||||
return this.output.end.apply(this.output, arguments);
|
return this.output.end.apply(this.output, arguments);
|
||||||
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
// ie TypeError
|
// ie TypeError
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,13 +278,17 @@ function SSHClient(clientConn) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
clientConn.on('end', () => {
|
clientConn.once('end', () => {
|
||||||
self.emit('end'); // remove client connection/tracking
|
return self.emit('end'); // remove client connection/tracking
|
||||||
});
|
});
|
||||||
|
|
||||||
clientConn.on('error', err => {
|
clientConn.on('error', err => {
|
||||||
self.log.warn( { error : err.message, code : err.code }, 'SSH connection error');
|
self.log.warn( { error : err.message, code : err.code }, 'SSH connection error');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.disconnect = function() {
|
||||||
|
return clientConn.end();
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
util.inherits(SSHClient, baseClient.Client);
|
util.inherits(SSHClient, baseClient.Client);
|
||||||
|
|
|
@ -550,6 +550,15 @@ function TelnetClient(input, output) {
|
||||||
this.emit('ready', { firstMenu : Config().loginServers.telnet.firstMenu } );
|
this.emit('ready', { firstMenu : Config().loginServers.telnet.firstMenu } );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.disconnect = function() {
|
||||||
|
try {
|
||||||
|
return this.output.end.apply(this.output, arguments);
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
// nothing
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
util.inherits(TelnetClient, baseClient.Client);
|
util.inherits(TelnetClient, baseClient.Client);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue