From 6566de49865a1798a509080c64d20ad6821d50aa Mon Sep 17 00:00:00 2001 From: zefie Date: Sat, 14 Jun 2025 19:01:02 -0400 Subject: [PATCH] just in case --- zefie_wtvp_minisrv/includes/classes/WTVIRC.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/zefie_wtvp_minisrv/includes/classes/WTVIRC.js b/zefie_wtvp_minisrv/includes/classes/WTVIRC.js index 1ee4aafa..1c9ae515 100644 --- a/zefie_wtvp_minisrv/includes/classes/WTVIRC.js +++ b/zefie_wtvp_minisrv/includes/classes/WTVIRC.js @@ -119,9 +119,7 @@ class WTVIRC { cert: certBuffer, }), }); - socket.push(firstChunk); - - + socket.push(firstChunk); secureSocket.on('error', (err) => { if (this.debug) { @@ -132,9 +130,7 @@ class WTVIRC { secureSocket.on('close', () => { this.terminateSession(secureSocket, false); - }); - - + }); // Only start processing after handshake is complete secureSocket.on('secure', () => { @@ -180,8 +176,7 @@ class WTVIRC { secureSocket.on('end', () => { this.terminateSession(secureSocket, false); }); - }); - + }); secureSocket.resume(); return; } else { @@ -241,6 +236,16 @@ class WTVIRC { } processSocketData(socket, data) { + // Ensure data is a string + if (typeof data !== 'string') { + if (Buffer.isBuffer(data)) { + data = data.toString('utf8'); + } else if (data && typeof data.toString === 'function') { + data = data.toString(); + } else { + return; // Invalid data, ignore + } + } const lines = data.split(/\r\n|\n/).filter(Boolean); for (let line of lines) { if (this.debug) {