Fixed realtime cleaner, socket should defined and notename is not a necessary in disconnect
This commit is contained in:
parent
ab6d6c77f1
commit
2c31b8d809
1 changed files with 3 additions and 6 deletions
|
@ -107,7 +107,7 @@ var updater = setInterval(function () {
|
||||||
var cleaner = setInterval(function () {
|
var cleaner = setInterval(function () {
|
||||||
async.each(Object.keys(users), function (key, callback) {
|
async.each(Object.keys(users), function (key, callback) {
|
||||||
var socket = realtime.io.sockets.connected[key];
|
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)
|
if (config.debug)
|
||||||
logger.info("cleaner found redundant user: " + key);
|
logger.info("cleaner found redundant user: " + key);
|
||||||
disconnectSocketQueue.push(socket);
|
disconnectSocketQueue.push(socket);
|
||||||
|
@ -353,14 +353,11 @@ function disconnect(socket) {
|
||||||
logger.info("SERVER disconnected a client");
|
logger.info("SERVER disconnected a client");
|
||||||
logger.info(JSON.stringify(users[socket.id]));
|
logger.info(JSON.stringify(users[socket.id]));
|
||||||
}
|
}
|
||||||
var notename = getNotenameFromSocket(socket);
|
|
||||||
if (!notename) {
|
|
||||||
isDisconnectBusy = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (users[socket.id]) {
|
if (users[socket.id]) {
|
||||||
delete users[socket.id];
|
delete users[socket.id];
|
||||||
}
|
}
|
||||||
|
var notename = getNotenameFromSocket(socket);
|
||||||
var note = notes[notename];
|
var note = notes[notename];
|
||||||
if (note) {
|
if (note) {
|
||||||
delete note.users[socket.id];
|
delete note.users[socket.id];
|
||||||
|
|
Loading…
Reference in a new issue