Fix a couple rare bugs around SSH sessions
This commit is contained in:
parent
4aab8224ed
commit
2f09f3e995
|
@ -119,7 +119,10 @@ function shutdownSystem() {
|
||||||
const activeConnections = ClientConns.getActiveConnections();
|
const activeConnections = ClientConns.getActiveConnections();
|
||||||
let i = activeConnections.length;
|
let i = activeConnections.length;
|
||||||
while(i--) {
|
while(i--) {
|
||||||
activeConnections[i].term.write('\n\nServer is shutting down NOW! Disconnecting...\n\n');
|
const activeTerm = activeConnections[i].term;
|
||||||
|
if(activeTerm) {
|
||||||
|
activeTerm.write('\n\nServer is shutting down NOW! Disconnecting...\n\n');
|
||||||
|
}
|
||||||
ClientConns.removeClient(activeConnections[i]);
|
ClientConns.removeClient(activeConnections[i]);
|
||||||
}
|
}
|
||||||
callback(null);
|
callback(null);
|
||||||
|
|
|
@ -184,7 +184,7 @@ function SSHClient(clientConn) {
|
||||||
if(self.input) { // do we have I/O?
|
if(self.input) { // do we have I/O?
|
||||||
self.updateTermInfo(info);
|
self.updateTermInfo(info);
|
||||||
} else {
|
} else {
|
||||||
self.cachedPtyInfo = info;
|
self.cachedTermInfo = info;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -197,9 +197,9 @@ function SSHClient(clientConn) {
|
||||||
|
|
||||||
channel.stdin.on('data', self.dataHandler);
|
channel.stdin.on('data', self.dataHandler);
|
||||||
|
|
||||||
if(self.cachedPtyInfo) {
|
if(self.cachedTermInfo) {
|
||||||
self.updateTermInfo(self.cachedPtyInfo);
|
self.updateTermInfo(self.cachedTermInfo);
|
||||||
delete self.cachedPtyInfo;
|
delete self.cachedTermInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we're ready!
|
// we're ready!
|
||||||
|
@ -210,7 +210,11 @@ function SSHClient(clientConn) {
|
||||||
session.on('window-change', (accept, reject, info) => {
|
session.on('window-change', (accept, reject, info) => {
|
||||||
self.log.debug(info, 'SSH window-change event');
|
self.log.debug(info, 'SSH window-change event');
|
||||||
|
|
||||||
|
if(self.input) {
|
||||||
self.updateTermInfo(info);
|
self.updateTermInfo(info);
|
||||||
|
} else {
|
||||||
|
self.cachedTermInfo = info;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue