From 33a1d1b8127bde81b0dcf56c26892cc5845b9a81 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sun, 12 Jul 2020 16:12:26 -0600 Subject: [PATCH] Idle timeout kicks user when on a telnet bridge downloading files #262 --- core/telnet_bridge.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/core/telnet_bridge.js b/core/telnet_bridge.js index 0c17715f..20397cd3 100644 --- a/core/telnet_bridge.js +++ b/core/telnet_bridge.js @@ -51,14 +51,22 @@ class TelnetClientConnection extends EventEmitter { constructor(client) { super(); - this.client = client; + this.client = client; + + this.dataHits = 0; } + updateActivity() { + if (0 === (this.dataHits++ % 4)) { + this.client.explicitActivityTimeUpdate(); + } + } restorePipe() { if(!this.pipeRestored) { this.pipeRestored = true; - this.client.dataPassthrough = false; + + this.client.restoreDataHandler(); // client may have bailed if(null !== _.get(this, 'client.term.output', null)) { @@ -75,11 +83,15 @@ class TelnetClientConnection extends EventEmitter { this.emit('connected'); this.pipeRestored = false; - this.client.dataPassthrough = true; - this.client.term.output.pipe(this.bridgeConnection); + this.client.setTemporaryDirectDataHandler(data => { + this.updateActivity(); + this.bridgeConnection.write(data); + }); }); this.bridgeConnection.on('data', data => { + this.updateActivity(); + this.client.term.rawWrite(data); //