From 9e56400f5380f56c9b773f8b37d245643afe5863 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Tue, 5 Nov 2013 22:45:11 -0600 Subject: [PATCH] Prevent double userLeave --- changelog | 4 ++++ lib/channel.js | 1 + 2 files changed, 5 insertions(+) diff --git a/changelog b/changelog index 154f6172..6db96fe4 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,7 @@ +Tue Nov 05 22:43 2013 CDT + * lib/channel.js: Set user.channel = null in userLeave to prevent + double execution of userLeave. + Tue Nov 05 22:38 2013 CDT * lib/database.js: Add a check for registrations-in-progress to prevent duplicate queries by an impatient user diff --git a/lib/channel.js b/lib/channel.js index 784c9f40..0fe7a4ef 100644 --- a/lib/channel.js +++ b/lib/channel.js @@ -860,6 +860,7 @@ Channel.prototype.userJoin = function(user) { } Channel.prototype.userLeave = function(user) { + user.channel = null; // Their socket might already be dead, so wrap in a try-catch try { user.socket.leave(this.name);