fix(core): update

This commit is contained in:
Philipp Kunz 2019-09-29 17:18:40 +02:00
parent 6dd3e473c6
commit 4ca748ec93
4 changed files with 20 additions and 5 deletions

6
package-lock.json generated
View File

@ -93,9 +93,9 @@
}
},
"@pushrocks/lik": {
"version": "3.0.10",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.10.tgz",
"integrity": "sha512-iWG06QsrL6AAnjPRWMVz4bRaRE0jJt/HgEK0YeLqaSBLY8ju4ps1j4lEN8VrUlXGZyPB6UGQfcreesO24buYhQ==",
"version": "3.0.11",
"resolved": "https://verdaccio.lossless.one/@pushrocks%2flik/-/lik-3.0.11.tgz",
"integrity": "sha512-SDKRPj9+xBTqozlDPcA7O6BcccM1Tw/sXPVP+OnhNxCubDZ/L2kGNpPpqm43NJUoNxSSo5wdBw4N7MAFYCGdVg==",
"requires": {
"@pushrocks/smartdelay": "^2.0.3",
"@pushrocks/smartpromise": "^3.0.2",

View File

@ -21,6 +21,7 @@
"tslint-config-prettier": "^1.15.0"
},
"dependencies": {
"@pushrocks/lik": "^3.0.11",
"@pushrocks/smartnetwork": "^1.1.14",
"@pushrocks/smartpromise": "^3.0.5",
"@pushrocks/smartrequest": "^1.1.35",

View File

@ -7,6 +7,7 @@ export class ProxyWorker {
public httpsServer: plugins.https.Server; // | plugins.http.Server;
public port = 8001;
public router = new SmartproxyRouter();
public socketMap = new plugins.lik.Objectmap<plugins.net.Socket>();
/**
* starts the proxyInstance
@ -168,6 +169,14 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
});
this.httpsServer.keepAliveTimeout = 61000;
this.httpsServer.headersTimeout = 65000;
this.httpsServer.on('connection', connection => {
this.socketMap.add(connection);
connection.on('close', () => {
this.socketMap.remove(connection);
});
});
this.httpsServer.listen(this.port);
console.log(`OK: now listening for new connections on port ${this.port}`);
}
@ -191,6 +200,9 @@ JNj2Dr5H0XoLFFnvuvzcRbhlJ9J67JzR+7g=
this.httpsServer.close(() => {
done.resolve();
});
await this.socketMap.forEach(async (socket) => {
socket.destroy();
});
await done.promise;
}
}

View File

@ -1,9 +1,10 @@
// node native scope
import * as http from 'http';
import * as https from 'https';
import * as net from 'net';
import * as url from 'url';
export { http, https, url };
export { http, https, net, url };
// tsclass scope
import * as tsclass from '@tsclass/tsclass';
@ -11,12 +12,13 @@ import * as tsclass from '@tsclass/tsclass';
export { tsclass };
// pushrocks scope
import * as lik from '@pushrocks/lik';
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartrequest from '@pushrocks/smartrequest';
import * as smartspawn from '@pushrocks/smartspawn';
import * as smartsystem from '@pushrocks/smartsystem';
export { smartrequest, smartpromise, smartspawn, smartsystem };
export { lik, smartrequest, smartpromise, smartspawn, smartsystem };
// third party scope
import * as ws from 'ws';