maybe fix timeouts

This commit is contained in:
zefie
2025-06-22 15:11:10 -04:00
parent d621b52eca
commit 8e2a72a86b

View File

@@ -139,7 +139,7 @@ class WTVIRC {
} }
this.server_start_time = this.getDate(); this.server_start_time = this.getDate();
this.server = net.createServer(async socket => { this.server = net.createServer(async socket => {
socket.timeout = this.socket_timeout; socket.setTimeout(this.socket_timeout);
// Detect SSL handshake and wrap socket if needed // Detect SSL handshake and wrap socket if needed
socket.once('data', async firstChunk => { socket.once('data', async firstChunk => {
this.totalConnections++; this.totalConnections++;
@@ -271,15 +271,16 @@ class WTVIRC {
socket.timestamp = this.getDate(); socket.timestamp = this.getDate();
socket.uniqueId = `${this.serverId}${this.generateUniqueId(socket)}`; socket.uniqueId = `${this.serverId}${this.generateUniqueId(socket)}`;
} }
socket.timeout = this.socket_timeout; socket.setTimeout(this.socket_timeout);
socket.secure = secure; socket.secure = secure;
socket.upgrading_to_tls = false; socket.upgrading_to_tls = false;
socket.error_count = 0; socket.error_count = 0;
await this.doInitialHandshake(socket); await this.doInitialHandshake(socket);
socket.on('timeout', () => { socket.on('timeout', () => {
this.debugLog('warn', `Socket timeout for ${socket.remoteAddress}`); 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); this.terminateSession(socket, true);
}); });