Prevent double userLeave

This commit is contained in:
calzoneman 2013-11-05 22:45:11 -06:00
parent 0db5f64b15
commit 9e56400f53
2 changed files with 5 additions and 0 deletions

View File

@ -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 Tue Nov 05 22:38 2013 CDT
* lib/database.js: Add a check for registrations-in-progress to prevent * lib/database.js: Add a check for registrations-in-progress to prevent
duplicate queries by an impatient user duplicate queries by an impatient user

View File

@ -860,6 +860,7 @@ Channel.prototype.userJoin = function(user) {
} }
Channel.prototype.userLeave = function(user) { Channel.prototype.userLeave = function(user) {
user.channel = null;
// Their socket might already be dead, so wrap in a try-catch // Their socket might already be dead, so wrap in a try-catch
try { try {
user.socket.leave(this.name); user.socket.leave(this.name);