RLG-Web server: code cleanup.
Delete some TermSession code left over from the first attempt at Websockets. Also don't bother logging the disconnection of watchers after the game has ended.
This commit is contained in:
parent
f4c4f5e0f1
commit
031bc239f8
1 changed files with 2 additions and 18 deletions
18
rlgwebd.js
18
rlgwebd.js
|
|
@ -131,8 +131,6 @@ function TermSession(game, lkey, dims, handlers) {
|
|||
* with a complete screen. */
|
||||
this.framebuf = new Buffer(1024);
|
||||
this.frameoff = 0;
|
||||
/* List of WebSockets watching the game. */
|
||||
this.watchsocks = [];
|
||||
logins[lkey].sessions.push(this.sessid);
|
||||
/* END setup */
|
||||
function ttyrec_chunk(datastr) {
|
||||
|
|
@ -171,21 +169,6 @@ function TermSession(game, lkey, dims, handlers) {
|
|||
this.write = function(data) {
|
||||
this.term.write(data);
|
||||
};
|
||||
// WebSocket watchers.
|
||||
this.addWS = function (conn) {
|
||||
this.watchsocks.push(conn);
|
||||
};
|
||||
this.removeWS = function (conn) {
|
||||
var i = this.watchsocks.indexOf(conn);
|
||||
if (i >= 0) {
|
||||
if (conn.connected)
|
||||
conn.close();
|
||||
this.watchsocks.splice(i, 1);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
};
|
||||
// Teardown.
|
||||
this.term.on("exit", function () {
|
||||
fs.unlink(ss.lock);
|
||||
|
|
@ -388,6 +371,7 @@ function wsWatcher(conn, session) {
|
|||
conn.on('close', function(code, desc) {
|
||||
session.removeListener('data', dataH);
|
||||
session.removeListener('exit', exitH);
|
||||
if (session.sessid in sessions)
|
||||
tslog("A WebSocket watcher has left game %d", session.sessid);
|
||||
});
|
||||
conn.sendUTF(JSON.stringify({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue