From bad8bf0688f8c0871f533fb448ca936769cdc7d2 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Fri, 29 Jul 2022 15:22:31 +0200 Subject: [PATCH] fix(core): update --- ts/00_commitinfo_data.ts | 2 +- ts/smartproxy.classes.networkproxy.ts | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index eda6d65..a327e69 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@pushrocks/smartproxy', - version: '3.0.8', + version: '3.0.9', description: 'a proxy for handling high workloads of proxying' } diff --git a/ts/smartproxy.classes.networkproxy.ts b/ts/smartproxy.classes.networkproxy.ts index 588dbaf..74c8b74 100644 --- a/ts/smartproxy.classes.networkproxy.ts +++ b/ts/smartproxy.classes.networkproxy.ts @@ -256,26 +256,28 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g= this.httpsServer.headersTimeout = 65000; this.httpsServer.on('connection', (connection: plugins.net.Socket) => { - connection.setTimeout(120000); + connection.setTimeout(10000); this.socketMap.add(connection); const cleanupConnection = () => { if (this.socketMap.checkForObject(connection)) { this.socketMap.remove(connection); - connection.end(); - connection.removeAllListeners(); - connection.destroy(); + connection.end(() => { + connection.destroy(); + connection.removeAllListeners(); + console.log(`socket successfully destroyed`); + }); } }; - connection.on('close', () => { + connection.addListener('close', () => { cleanupConnection(); }); - connection.on('error', () => { + connection.addListener('error', () => { cleanupConnection(); }); - connection.on('end', () => { + connection.addListener('end', () => { cleanupConnection(); }); - connection.on('timeout', () => { + connection.addListener('timeout', () => { cleanupConnection(); }); });