From: Darren Date: Mon, 29 Oct 2012 20:20:39 +0000 (+0000) Subject: Server: re-arranged disposing X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=e6b973daba52848b5bf60885fe12b38cc7f45189;p=KiwiIRC.git Server: re-arranged disposing Websocket event handlers should not have to worry about emiting 'destory' event, that is the disposings job --- 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