fix(core): update

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

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();
});
}
};