From 8e2a72a86b0500dbae4b9c0a57b206ae877bc6ce Mon Sep 17 00:00:00 2001 From: zefie Date: Sun, 22 Jun 2025 15:11:10 -0400 Subject: [PATCH] maybe fix timeouts --- zefie_wtvp_minisrv/includes/classes/WTVIRC.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zefie_wtvp_minisrv/includes/classes/WTVIRC.js b/zefie_wtvp_minisrv/includes/classes/WTVIRC.js index 63a2b463..c2cda640 100644 --- a/zefie_wtvp_minisrv/includes/classes/WTVIRC.js +++ b/zefie_wtvp_minisrv/includes/classes/WTVIRC.js @@ -139,7 +139,7 @@ class WTVIRC { } this.server_start_time = this.getDate(); this.server = net.createServer(async socket => { - socket.timeout = this.socket_timeout; + socket.setTimeout(this.socket_timeout); // Detect SSL handshake and wrap socket if needed socket.once('data', async firstChunk => { this.totalConnections++; @@ -271,15 +271,16 @@ class WTVIRC { socket.timestamp = this.getDate(); socket.uniqueId = `${this.serverId}${this.generateUniqueId(socket)}`; } - socket.timeout = this.socket_timeout; + socket.setTimeout(this.socket_timeout); socket.secure = secure; socket.upgrading_to_tls = false; socket.error_count = 0; await this.doInitialHandshake(socket); + socket.on('timeout', () => { this.debugLog('warn', `Socket timeout for ${socket.remoteAddress}`); - this.broadcastUser(socket.nickname, `:${socket.nickname}!${socket.username}@${socket.host} QUIT :Ping Timeout (${this.socket_timeout / 1000} seconds)\r\n`); + this.broadcastUser(socket.nickname, `:${socket.nickname}!${socket.username}@${socket.host} QUIT :Ping Timeout (${this.socket_timeout / 1000} seconds)\r\n`, socket); this.terminateSession(socket, true); });