diff --git a/changelog b/changelog index 9d2a2100..00145155 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,10 @@ +Mon Sep 9 22:10 2013 CDT + * lib/acp.js: Change acp-channel-unload callback to duplicate the list + of users in the channel to prevent concurrent modification while + kicking + * lib/channel.js: As an extra precaution, set user.channel = null after + kicking a user + Sun Sep 8 17:41 2013 CDT * lib/server.js: Change behavior of unloadChannel - deletes all object keys in the channel object and then sets channel.dead = true diff --git a/lib/acp.js b/lib/acp.js index e817a914..e318d08a 100644 --- a/lib/acp.js +++ b/lib/acp.js @@ -135,7 +135,10 @@ module.exports = function (Server) { return; ActionLog.record(user.ip, user.name, "acp-channel-unload"); c.initialized = data.save; - c.users.forEach(function(u) { + // copy the list of users to prevent concurrent + // modification + var users = Array.prototype.slice.call(c.users); + users.forEach(function (u) { c.kick(u, "Channel shutting down"); }); diff --git a/lib/channel.js b/lib/channel.js index 287ff821..086cc909 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -862,10 +862,8 @@ Channel.prototype.kick = function(user, reason) { user.socket.emit("kick", { reason: reason }); - if(user.socket.disconnected) { - this.userLeave(user); - } user.socket.disconnect(true); + user.channel = null; } Channel.prototype.hideIP = function(ip) {