fix(core): update

This commit is contained in:
Philipp Kunz 2022-07-29 15:26:02 +02:00
parent 5e6477720d
commit 2f0fad999a
2 changed files with 7 additions and 5 deletions

View File

@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@pushrocks/smartproxy', name: '@pushrocks/smartproxy',
version: '3.0.9', version: '3.0.10',
description: 'a proxy for handling high workloads of proxying' description: 'a proxy for handling high workloads of proxying'
} }

View File

@ -258,9 +258,11 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
this.httpsServer.on('connection', (connection: plugins.net.Socket) => { this.httpsServer.on('connection', (connection: plugins.net.Socket) => {
connection.setTimeout(10000); connection.setTimeout(10000);
this.socketMap.add(connection); this.socketMap.add(connection);
console.log(`added connection. now ${this.socketMap.getArray().length} sockets connected.`);
const cleanupConnection = () => { const cleanupConnection = () => {
if (this.socketMap.checkForObject(connection)) { if (this.socketMap.checkForObject(connection)) {
this.socketMap.remove(connection); this.socketMap.remove(connection);
console.log(`removed connection. ${this.socketMap.getArray().length} sockets remaining.`);
connection.end(() => { connection.end(() => {
connection.destroy(); connection.destroy();
connection.removeAllListeners(); connection.removeAllListeners();
@ -268,16 +270,16 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
}); });
} }
}; };
connection.addListener('close', () => { connection.on('close', () => {
cleanupConnection(); cleanupConnection();
}); });
connection.addListener('error', () => { connection.on('error', () => {
cleanupConnection(); cleanupConnection();
}); });
connection.addListener('end', () => { connection.on('end', () => {
cleanupConnection(); cleanupConnection();
}); });
connection.addListener('timeout', () => { connection.on('timeout', () => {
cleanupConnection(); cleanupConnection();
}); });
}); });