# HG changeset patch # User John "Elwin" Edwards # Date 1342194737 25200 # Node ID f34a286c51bd847a1f89d41e2437144bc4a34a81 # Parent e59d68082664eac319f17e4584cad24cc2c1a153 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. diff -r e59d68082664 -r f34a286c51bd rlgwebd.js --- a/rlgwebd.js Fri Jul 13 08:39:39 2012 -0700 +++ b/rlgwebd.js Fri Jul 13 08:52:17 2012 -0700 @@ -131,8 +131,6 @@ * 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 @@ 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,7 +371,8 @@ conn.on('close', function(code, desc) { session.removeListener('data', dataH); session.removeListener('exit', exitH); - tslog("A WebSocket watcher has left game %d", session.sessid); + if (session.sessid in sessions) + tslog("A WebSocket watcher has left game %d", session.sessid); }); conn.sendUTF(JSON.stringify({ "t": "w", "w": session.w, "h": session.h,