diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/realtime.js | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/realtime.js b/lib/realtime.js index 3e99a12d..d2c9fe68 100644 --- a/lib/realtime.js +++ b/lib/realtime.js @@ -107,7 +107,7 @@ var updater = setInterval(function () { var cleaner = setInterval(function () { async.each(Object.keys(users), function (key, callback) { var socket = realtime.io.sockets.connected[key]; - if (!socket || !socket.rooms || socket.rooms.length <= 0) { + if (socket && (!socket.rooms || socket.rooms.length <= 0)) { if (config.debug) logger.info("cleaner found redundant user: " + key); disconnectSocketQueue.push(socket); @@ -353,14 +353,11 @@ function disconnect(socket) { logger.info("SERVER disconnected a client"); logger.info(JSON.stringify(users[socket.id])); } - var notename = getNotenameFromSocket(socket); - if (!notename) { - isDisconnectBusy = false; - return; - } + if (users[socket.id]) { delete users[socket.id]; } + var notename = getNotenameFromSocket(socket); var note = notes[notename]; if (note) { delete note.users[socket.id]; |