Triggering connection 'close' event fix
[KiwiIRC.git] / server / irc / connection.js
index da5f17346ba129b47058e064e01c928d9d0a3d9c..6267725652acd200c3dcf48b651c2504cbba78a2 100644 (file)
@@ -315,7 +315,10 @@ IrcConnection.prototype.connect = function () {
             // Close the whole socket down
             that.disposeSocket();
 
-            if (global.config.ircd_reconnect) {
+            if (!global.config.ircd_reconnect) {
+                that.emit('close', had_error);
+
+            } else {
                 // If trying to reconnect, continue with it
                 if (that.reconnect_attempts && that.reconnect_attempts < 3) {
                     should_reconnect = true;