diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 74e9454..fb66e35 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.17', + version: '3.0.18', description: 'a proxy for handling high workloads of proxying' } diff --git a/ts/smartproxy.classes.networkproxy.ts b/ts/smartproxy.classes.networkproxy.ts index 91fd6d3..800e1d2 100644 --- a/ts/smartproxy.classes.networkproxy.ts +++ b/ts/smartproxy.classes.networkproxy.ts @@ -187,12 +187,22 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g= }, true, // lets make this streaming (request) => { + req.setTimeout(60000); req.on('data', (data) => { request.write(data); }); req.on('end', (data) => { request.end(); }); + req.on('error', () => { + request.end(); + }); + req.on('close', () => { + request.end(); + }); + req.on('timeout', () => { + request.end(); + }) } ); res.statusCode = response.statusCode; @@ -246,12 +256,12 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g= // handle closing const cleanUp = () => { - ws.removeAllListeners(); ws.close(); ws.terminate(); - wsc.removeAllListeners(); + ws.removeAllListeners(); wsc.close(); wsc.terminate(); + wsc.removeAllListeners(); }; ws.on('close', (message) => { @@ -265,7 +275,7 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g= this.httpsServer.headersTimeout = 65000; this.httpsServer.on('connection', (connection: plugins.net.Socket) => { - connection.setTimeout(10000); + connection.setTimeout(61000); let destroyed = false; this.socketMap.add(connection); console.log(`added connection. now ${this.socketMap.getArray().length} sockets connected.`); @@ -274,9 +284,6 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g= destroyed = true; connection.destroy(); console.log(`socket successfully destroyed.`); - plugins.smartdelay.delayFor(1000).then(() => { - connection.removeAllListeners(); - }); } } const cleanupConnection = () => {