Don't idle logout if a transfer is making progress
This commit is contained in:
parent
59ee52ea6f
commit
387dfb3b5d
|
@ -84,7 +84,7 @@ function Client(/*input, output*/) {
|
|||
|
||||
this.user = new User();
|
||||
this.currentTheme = { info : { name : 'N/A', description : 'None' } };
|
||||
this.lastKeyPressMs = Date.now();
|
||||
this.lastActivityTime = Date.now();
|
||||
this.menuStack = new MenuStack(this);
|
||||
this.acs = new ACS( { client : this, user : this.user } );
|
||||
this.mciCache = {};
|
||||
|
@ -406,7 +406,7 @@ function Client(/*input, output*/) {
|
|||
self.log.trace( { key : key, ch : escape(ch) }, 'User keyboard input'); // jshint ignore:line
|
||||
}
|
||||
|
||||
self.lastKeyPressMs = Date.now();
|
||||
self.lastActivityTime = Date.now();
|
||||
|
||||
if(!self.ignoreInput) {
|
||||
self.emit('key press', ch, key);
|
||||
|
@ -438,7 +438,7 @@ Client.prototype.startIdleMonitor = function() {
|
|||
this.stopIdleMonitor();
|
||||
}
|
||||
|
||||
this.lastKeyPressMs = Date.now();
|
||||
this.lastActivityTime = Date.now();
|
||||
|
||||
//
|
||||
// Every 1m, check for idle.
|
||||
|
@ -476,7 +476,7 @@ Client.prototype.startIdleMonitor = function() {
|
|||
// use override value if set
|
||||
idleLogoutSeconds = this.idleLogoutSecondsOverride || idleLogoutSeconds;
|
||||
|
||||
if(idleLogoutSeconds > 0 && (nowMs - this.lastKeyPressMs >= (idleLogoutSeconds * 1000))) {
|
||||
if(idleLogoutSeconds > 0 && (nowMs - this.lastActivityTime >= (idleLogoutSeconds * 1000))) {
|
||||
this.emit('idle timeout');
|
||||
}
|
||||
}, 1000 * 60);
|
||||
|
@ -489,6 +489,10 @@ Client.prototype.stopIdleMonitor = function() {
|
|||
}
|
||||
};
|
||||
|
||||
Client.prototype.explicitActivityTimeUpdate = function() {
|
||||
this.lastActivityTime = Date.now();
|
||||
}
|
||||
|
||||
Client.prototype.overrideIdleLogoutSeconds = function(seconds) {
|
||||
this.idleLogoutSecondsOverride = seconds;
|
||||
};
|
||||
|
|
|
@ -378,7 +378,16 @@ exports.getModule = class TransferFileModule extends MenuModule {
|
|||
|
||||
const externalProc = pty.spawn(cmd, args, spawnOpts);
|
||||
|
||||
let dataHits = 0;
|
||||
const updateActivity = () => {
|
||||
if (0 === (dataHits++ % 4)) {
|
||||
this.client.explicitActivityTimeUpdate();
|
||||
}
|
||||
};
|
||||
|
||||
this.client.setTemporaryDirectDataHandler(data => {
|
||||
updateActivity();
|
||||
|
||||
// needed for things like sz/rz
|
||||
if(external.escapeTelnet) {
|
||||
const tmp = data.toString('binary').replace(/\xff{2}/g, '\xff'); // de-escape
|
||||
|
@ -389,6 +398,8 @@ exports.getModule = class TransferFileModule extends MenuModule {
|
|||
});
|
||||
|
||||
externalProc.on('data', data => {
|
||||
updateActivity();
|
||||
|
||||
// needed for things like sz/rz
|
||||
if(external.escapeTelnet) {
|
||||
const tmp = data.toString('binary').replace(/\xff/g, '\xff\xff'); // escape
|
||||
|
|
Loading…
Reference in New Issue