fix(core): update

This commit is contained in:
Philipp Kunz 2022-07-29 15:22:31 +02:00
parent 4f1db106fb
commit bad8bf0688
2 changed files with 11 additions and 9 deletions

View File

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

View File

@ -256,26 +256,28 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
this.httpsServer.headersTimeout = 65000; this.httpsServer.headersTimeout = 65000;
this.httpsServer.on('connection', (connection: plugins.net.Socket) => { this.httpsServer.on('connection', (connection: plugins.net.Socket) => {
connection.setTimeout(120000); connection.setTimeout(10000);
this.socketMap.add(connection); this.socketMap.add(connection);
const cleanupConnection = () => { const cleanupConnection = () => {
if (this.socketMap.checkForObject(connection)) { if (this.socketMap.checkForObject(connection)) {
this.socketMap.remove(connection); this.socketMap.remove(connection);
connection.end(); connection.end(() => {
connection.removeAllListeners();
connection.destroy(); connection.destroy();
connection.removeAllListeners();
console.log(`socket successfully destroyed`);
});
} }
}; };
connection.on('close', () => { connection.addListener('close', () => {
cleanupConnection(); cleanupConnection();
}); });
connection.on('error', () => { connection.addListener('error', () => {
cleanupConnection(); cleanupConnection();
}); });
connection.on('end', () => { connection.addListener('end', () => {
cleanupConnection(); cleanupConnection();
}); });
connection.on('timeout', () => { connection.addListener('timeout', () => {
cleanupConnection(); cleanupConnection();
}); });
}); });