From 6f5dc63433d368fe4d4712d3aa341d039de783d7 Mon Sep 17 00:00:00 2001
From: deuce <>
Date: Fri, 3 Apr 2020 21:32:24 +0000
Subject: [PATCH] Get the outgoing check out of the local check. It seems we
 don't actually close() remote sockets, we let the destructor do that.

---
 exec/load/ircd_server.js | 19 +++++++++----------
 exec/load/ircd_user.js   | 19 +++++++++----------
 2 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/exec/load/ircd_server.js b/exec/load/ircd_server.js
index df2057afbf..7579e9caa1 100644
--- a/exec/load/ircd_server.js
+++ b/exec/load/ircd_server.js
@@ -1212,19 +1212,18 @@ function Server_Quit(str,suppress_bcast,is_netsplit,origin) {
 		gnotice("Closing Link: " + this.nick + " (" + str + ")");
 		this.rawout("ERROR :Closing Link: [" + this.uprefix + "@" + this.hostname + "] (" + str + ")");
 
-		if (this.socket!=undefined) {
+		if (this.socket!=undefined)
 			this.socket.close();
-			if (this.outgoing) {
-				if (YLines[this.ircclass].active > 0) {
-					YLines[this.ircclass].active--;
-					log(LOG_DEBUG, "Class "+this_cline.ircclass+" down to "+YLines[this_cline.ircclass].active+" active out of "+YLines[this_cline.ircclass].maxlinks);
-				}
-				else
-					log(LOG_ERROR, format("Class %d YLine going negative", this.ircclass));
-			}
-		}
 		delete Local_Sockets[this.id];
 	}
+	if (this.outgoing) {
+		if (YLines[this.ircclass].active > 0) {
+			YLines[this.ircclass].active--;
+			log(LOG_DEBUG, "Class "+this_cline.ircclass+" down to "+YLines[this_cline.ircclass].active+" active out of "+YLines[this_cline.ircclass].maxlinks);
+		}
+		else
+			log(LOG_ERROR, format("Class %d YLine going negative", this.ircclass));
+	}
 	delete Local_Sockets[this.id];
 	delete Local_Sockets_Map[this.id];
 	delete Local_Servers[this.id];
diff --git a/exec/load/ircd_user.js b/exec/load/ircd_user.js
index 43d6ae774d..27900c1e03 100644
--- a/exec/load/ircd_user.js
+++ b/exec/load/ircd_user.js
@@ -1548,18 +1548,17 @@ function User_Quit(str,suppress_bcast,is_netsplit,origin) {
 		umode_notice(USERMODE_CLIENT,"Client","Client exiting: " + this.nick
 			+ " (" + this.uprefix + "@" + this.hostname + ") [" + str + "] ["
 			+ this.ip + "]");
-		if (this.socket!=undefined) {
+		if (this.socket!=undefined)
 			this.socket.close();
-			if (this.outgoing) {
-				log(LOG_ERROR, "Outgoing USER connection detected!");
-				if (YLines[this.ircclass].active > 0) {
-					YLines[this.ircclass].active--;
-					log(LOG_DEBUG, "Class "+this_cline.ircclass+" down to "+YLines[this_cline.ircclass].active+" active out of "+YLines[this_cline.ircclass].maxlinks);
-				}
-				else
-					log(LOG_ERROR, format("Class %d YLine going negative", this.ircclass));
-			}
+	}
+	if (this.outgoing) {
+		log(LOG_ERROR, "Outgoing USER connection detected!");
+		if (YLines[this.ircclass].active > 0) {
+			YLines[this.ircclass].active--;
+			log(LOG_DEBUG, "Class "+this_cline.ircclass+" down to "+YLines[this_cline.ircclass].active+" active out of "+YLines[this_cline.ircclass].maxlinks);
 		}
+		else
+			log(LOG_ERROR, format("Class %d YLine going negative", this.ircclass));
 	}
 
 	delete Local_Sockets[this.id];
-- 
GitLab