removeClient() at logoff()

This commit is contained in:
Bryan Ashby 2016-01-02 12:10:54 -07:00
parent b3e1490d63
commit 7b521d8699
1 changed files with 5 additions and 3 deletions

View File

@ -2,7 +2,7 @@
'use strict'; 'use strict';
var theme = require('./theme.js'); var theme = require('./theme.js');
var clientConnections = require('./client_connections.js').clientConnections; var removeClient = require('./client_connections.js').removeClient;
var ansi = require('./ansi_term.js'); var ansi = require('./ansi_term.js');
var userDb = require('./database.js').dbs.user; var userDb = require('./database.js').dbs.user;
var sysProp = require('./system_property.js'); var sysProp = require('./system_property.js');
@ -50,9 +50,11 @@ function logoff(callingMenu, formData, extraArgs) {
client.term.write( client.term.write(
ansi.normal() + '\n' + ansi.normal() + '\n' +
iconv.decode(require('crypto').randomBytes(Math.floor(Math.random() * 65) + 20), client.term.outputEncoding) + iconv.decode(require('crypto').randomBytes(Math.floor(Math.random() * 65) + 20), client.term.outputEncoding) +
'NO CARRIER'); 'NO CARRIER', null, function written() {
client.end(); // after data is written, disconnect & remove the client
removeClient(client);
});
}, 500); }, 500);
} }