From e6b973daba52848b5bf60885fe12b38cc7f45189 Mon Sep 17 00:00:00 2001 From: Darren Date: Mon, 29 Oct 2012 20:20:39 +0000 Subject: [PATCH] Server: re-arranged disposing Websocket event handlers should not have to worry about emiting 'destory' event, that is the disposings job --- server/client.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/client.js b/server/client.js index 1dc47e2..666384c 100755 --- a/server/client.js +++ b/server/client.js @@ -65,7 +65,7 @@ Client.prototype.sendKiwiCommand = function (command, data, callback) { }; Client.prototype.dispose = function () { - websocketDisconnect.apply(this); + this.emit('destroy'); this.removeAllListeners(); }; @@ -152,12 +152,12 @@ function websocketDisconnect() { cons[i] = null; } }); - this.emit('destroy'); + + this.dispose(); } // TODO: Should this close all the websocket connections too? function websocketError() { - this.emit('destroy'); this.dispose(); } \ No newline at end of file -- 2.25.1