* ClientTerminal now has disconnect() method called by a client when a connection ends thus preventing data to be written after
This commit is contained in:
parent
a5a912f676
commit
6af0861dfe
|
@ -415,7 +415,13 @@ Client.prototype.startIdleMonitor = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
Client.prototype.end = function () {
|
Client.prototype.end = function () {
|
||||||
this.menuStack.getCurrentModule().leave();
|
this.term.disconnect();
|
||||||
|
|
||||||
|
var currentModule = this.menuStack.getCurrentModule();
|
||||||
|
|
||||||
|
if(currentModule) {
|
||||||
|
currentModule.leave();
|
||||||
|
}
|
||||||
|
|
||||||
clearInterval(this.idleCheck);
|
clearInterval(this.idleCheck);
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,10 @@ function ClientTerminal(output) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClientTerminal.prototype.disconnect = function() {
|
||||||
|
this.output = null;
|
||||||
|
};
|
||||||
|
|
||||||
ClientTerminal.prototype.isANSI = function() {
|
ClientTerminal.prototype.isANSI = function() {
|
||||||
// :TODO: Others??
|
// :TODO: Others??
|
||||||
return [ 'ansi', 'pc-ansi', 'qansi', 'scoansi', 'syncterm' ].indexOf(this.termType) > -1;
|
return [ 'ansi', 'pc-ansi', 'qansi', 'scoansi', 'syncterm' ].indexOf(this.termType) > -1;
|
||||||
|
@ -140,11 +144,17 @@ ClientTerminal.prototype.isANSI = function() {
|
||||||
// :TODO: probably need to update these to convert IAC (0xff) -> IACIAC (escape it)
|
// :TODO: probably need to update these to convert IAC (0xff) -> IACIAC (escape it)
|
||||||
|
|
||||||
ClientTerminal.prototype.write = function(s, convertLineFeeds) {
|
ClientTerminal.prototype.write = function(s, convertLineFeeds) {
|
||||||
this.output.write(this.encode(s, convertLineFeeds));
|
this.rawWrite(this.encode(s, convertLineFeeds));
|
||||||
};
|
};
|
||||||
|
|
||||||
ClientTerminal.prototype.rawWrite = function(s) {
|
ClientTerminal.prototype.rawWrite = function(s) {
|
||||||
this.output.write(s);
|
if(this.output) {
|
||||||
|
this.output.write(s, function written(err) {
|
||||||
|
if(err) {
|
||||||
|
Log.warn('Failed writing to socket: ' + err.toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ClientTerminal.prototype.pipeWrite = function(s, spec) {
|
ClientTerminal.prototype.pipeWrite = function(s, spec) {
|
||||||
|
|
Loading…
Reference in New Issue