fix(core): update

This commit is contained in:
Philipp Kunz 2022-07-30 13:30:25 +02:00
parent b8e53e7b42
commit 49e2e90bda
5 changed files with 17 additions and 4 deletions

1
package-lock.json generated
View File

@ -10,6 +10,7 @@
"license": "MIT",
"dependencies": {
"@pushrocks/lik": "^6.0.0",
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartpromise": "^3.1.7",
"@pushrocks/smartrequest": "^2.0.5",
"@pushrocks/smartstring": "^4.0.2",

View File

@ -22,6 +22,7 @@
},
"dependencies": {
"@pushrocks/lik": "^6.0.0",
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartpromise": "^3.1.7",
"@pushrocks/smartrequest": "^2.0.5",
"@pushrocks/smartstring": "^4.0.2",

View File

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

View File

@ -257,15 +257,25 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
this.httpsServer.on('connection', (connection: plugins.net.Socket) => {
connection.setTimeout(10000);
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(() => {
connection.destroy();
console.log(`socket successfully destroyed`);
destroyConnection();
});
}
};

View File

@ -13,11 +13,12 @@ export { tsclass };
// pushrocks scope
import * as lik from '@pushrocks/lik';
import * as smartdelay from '@pushrocks/smartdelay';
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartrequest from '@pushrocks/smartrequest';
import * as smartstring from '@pushrocks/smartstring';
export { lik, smartrequest, smartpromise, smartstring };
export { lik, smartdelay, smartrequest, smartpromise, smartstring };
// third party scope
import * as ws from 'ws';