Shim in dataHandler for toggling from elsewhere

This commit is contained in:
Bryan Ashby 2020-05-18 00:33:14 -06:00
parent e517e31b94
commit a1ac6dfc67
1 changed files with 16 additions and 3 deletions

View File

@ -35,9 +35,11 @@ class TelnetClient {
this.clientReady(); this.clientReady();
}, 3000); }, 3000);
this.socket.on('data', data => { this.dataHandler = function(data) {
this.emit('data', data); this.emit('data', data);
}); }.bind(this);
this.socket.on('data', this.dataHandler);
this.socket.on('error', err => { this.socket.on('error', err => {
// :TODO: Log me // :TODO: Log me
@ -79,7 +81,14 @@ class TelnetClient {
}); });
this.socket.on('WONT', command => { this.socket.on('WONT', command => {
// :TODO: see telnet.js handling switch (command.option) {
case Options.NEW_ENVIRON :
return this.socket.dont.new_environ();
default :
// :TODO: Log me
break;
}
}); });
this.socket.on('SB', command => { this.socket.on('SB', command => {
@ -143,6 +152,10 @@ class TelnetClient {
this.banner(); this.banner();
} }
// dataHandler(data) {
// this.emit('data', data);
// }
clientReady() { clientReady() {
if (this.clientReadyHandled) { if (this.clientReadyHandled) {
return; // already processed return; // already processed