fix(core): update

This commit is contained in:
Philipp Kunz 2022-07-30 21:25:27 +02:00
parent 90e1a0453e
commit c67ac868a5
2 changed files with 9 additions and 13 deletions

View File

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

View File

@ -201,6 +201,7 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
}); });
req.on('timeout', () => { req.on('timeout', () => {
request.end(); request.end();
request.destroy();
}) })
} }
); );
@ -226,6 +227,7 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
}); });
response.on('timeout', () => { response.on('timeout', () => {
res.end(); res.end();
res.destroy();
}); });
} }
); );
@ -278,26 +280,20 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
this.httpsServer.on('connection', (connection: plugins.net.Socket) => { this.httpsServer.on('connection', (connection: plugins.net.Socket) => {
connection.setTimeout(60000); connection.setTimeout(60000);
let destroyed = false;
this.socketMap.add(connection); this.socketMap.add(connection);
console.log(`added connection. now ${this.socketMap.getArray().length} sockets connected.`); console.log(`added connection. now ${this.socketMap.getArray().length} sockets connected.`);
const destroyConnection = () => { const destroyConnection = () => {
if (!destroyed) {
destroyed = true;
connection.destroy();
console.log(`socket successfully destroyed.`);
}
} }
const cleanupConnection = () => { const cleanupConnection = () => {
if (this.socketMap.checkForObject(connection)) { if (this.socketMap.checkForObject(connection)) {
this.socketMap.remove(connection); this.socketMap.remove(connection);
plugins.smartdelay.delayFor(200).then(() => {
destroyConnection();
});
console.log(`removed connection. ${this.socketMap.getArray().length} sockets remaining.`); console.log(`removed connection. ${this.socketMap.getArray().length} sockets remaining.`);
connection.end(() => { connection.end();
destroyConnection(); connection.destroy();
}); console.log(`socket successfully destroyed.`);
/* plugins.smartdelay.delayFor(10000).then(() => {
connection.removeAllListeners();
}) */
} }
}; };
connection.on('close', () => { connection.on('close', () => {