From b21c3dbee826abd12d4b44311b66562fb13a0f73 Mon Sep 17 00:00:00 2001 From: tommedema Date: Mon, 29 Aug 2011 11:21:50 +0300 Subject: [PATCH] Setting disconnected = true prior to firing disconnect event, to avoid scenario where socket disconnected is set to false inside disconnect event. --- lib/socket.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/socket.js b/lib/socket.js index 22a8abf41a..030fb6e49c 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -1,4 +1,3 @@ - /*! * socket.io-node * Copyright(c) 2011 LearnBoost @@ -133,8 +132,8 @@ Socket.prototype.setFlags = function () { Socket.prototype.onDisconnect = function (reason) { if (!this.disconnected) { - this.$emit('disconnect', reason); this.disconnected = true; + this.$emit('disconnect', reason); } };