From c67ac868a5aa66f17343d39b3ed121e04bef790b Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Sat, 30 Jul 2022 21:25:27 +0200 Subject: [PATCH] fix(core): update --- ts/00_commitinfo_data.ts | 2 +- ts/smartproxy.classes.networkproxy.ts | 20 ++++++++------------ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index ff32d2d..993b316 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.21', + version: '3.0.22', description: 'a proxy for handling high workloads of proxying' } diff --git a/ts/smartproxy.classes.networkproxy.ts b/ts/smartproxy.classes.networkproxy.ts index 6be88f5..3ad58a5 100644 --- a/ts/smartproxy.classes.networkproxy.ts +++ b/ts/smartproxy.classes.networkproxy.ts @@ -201,6 +201,7 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g= }); req.on('timeout', () => { request.end(); + request.destroy(); }) } ); @@ -226,6 +227,7 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g= }); response.on('timeout', () => { res.end(); + res.destroy(); }); } ); @@ -278,26 +280,20 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g= this.httpsServer.on('connection', (connection: plugins.net.Socket) => { connection.setTimeout(60000); - let destroyed = false; this.socketMap.add(connection); console.log(`added connection. now ${this.socketMap.getArray().length} sockets connected.`); const destroyConnection = () => { - if (!destroyed) { - destroyed = true; - connection.destroy(); - console.log(`socket successfully destroyed.`); - } } const cleanupConnection = () => { if (this.socketMap.checkForObject(connection)) { this.socketMap.remove(connection); - plugins.smartdelay.delayFor(200).then(() => { - destroyConnection(); - }); console.log(`removed connection. ${this.socketMap.getArray().length} sockets remaining.`); - connection.end(() => { - destroyConnection(); - }); + connection.end(); + connection.destroy(); + console.log(`socket successfully destroyed.`); + /* plugins.smartdelay.delayFor(10000).then(() => { + connection.removeAllListeners(); + }) */ } }; connection.on('close', () => {