just in case

This commit is contained in:
zefie
2025-06-14 19:01:02 -04:00
parent 9d18df4af1
commit 6566de4986

View File

@@ -121,8 +121,6 @@ class WTVIRC {
}); });
socket.push(firstChunk); socket.push(firstChunk);
secureSocket.on('error', (err) => { secureSocket.on('error', (err) => {
if (this.debug) { if (this.debug) {
console.error('TLS error:', err); console.error('TLS error:', err);
@@ -134,8 +132,6 @@ class WTVIRC {
this.terminateSession(secureSocket, false); this.terminateSession(secureSocket, false);
}); });
// Only start processing after handshake is complete // Only start processing after handshake is complete
secureSocket.on('secure', () => { secureSocket.on('secure', () => {
if (this.debug) { if (this.debug) {
@@ -181,7 +177,6 @@ class WTVIRC {
this.terminateSession(secureSocket, false); this.terminateSession(secureSocket, false);
}); });
}); });
secureSocket.resume(); secureSocket.resume();
return; return;
} else { } else {
@@ -241,6 +236,16 @@ class WTVIRC {
} }
processSocketData(socket, data) { 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); const lines = data.split(/\r\n|\n/).filter(Boolean);
for (let line of lines) { for (let line of lines) {
if (this.debug) { if (this.debug) {