Tweaking SocksConnection internals/API
[KiwiIRC.git] / server / irc / connection.js
index 311c811b1965bbed6643ca44484d2acd282b99eb..ce24ece4a75d54eb8fd2c98286e887ab4705229c 100644 (file)
@@ -186,8 +186,11 @@ IrcConnection.prototype.dispose = function () {
     _.each(this.irc_channels, function (chan) {
         chan.dispose();
     });
-    this.irc_users = null;
-    this.irc_channels = null;
+    this.irc_users = undefined;
+    this.irc_channels = undefined;
+
+    this.server.dispose();
+    this.server = undefined;
 
     EventBinder.unbindIrcEvents('', this.irc_events, this);
 
@@ -202,6 +205,7 @@ IrcConnection.prototype.dispose = function () {
  */
 IrcConnection.prototype.disposeSocket = function () {
     if (this.socket) {
+        this.socket.end();
         this.socket.removeAllListeners();
         this.socket = null;
     }