Compare commits

...

6 Commits

Author SHA1 Message Date
0f82d63f5c 2.0.7 2021-02-03 00:13:30 +00:00
b5fcdadd3d fix(core): update 2021-02-03 00:13:29 +00:00
6168b07414 2.0.6 2021-02-02 21:59:55 +00:00
588179335a fix(core): update 2021-02-02 21:59:54 +00:00
703cbedad4 2.0.5 2021-02-02 21:59:25 +00:00
dd7e9e8416 fix(core): update 2021-02-02 21:59:24 +00:00
3 changed files with 30 additions and 5 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartproxy",
"version": "2.0.4",
"version": "2.0.7",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartproxy",
"version": "2.0.4",
"version": "2.0.7",
"private": false,
"description": "a proxy for handling high workloads of proxying",
"main": "dist_ts/index.js",

View File

@ -18,6 +18,16 @@ const portProxyCalls = {
response.end();
});
httpServer.listen(7999);
const cleanUpSockets = (from: plugins.net.Socket, to: plugins.net.Socket) => {
from.end();
to.end();
from.removeAllListeners();
to.removeAllListeners();
from.unpipe();
to.unpipe();
from.destroy();
to.destroy();
}
netServer = net
.createServer((from) => {
const to = net.createConnection({
@ -27,14 +37,29 @@ const portProxyCalls = {
from.pipe(to);
to.pipe(from);
from.on('error', () => {
from.end(), to.end();
cleanUpSockets(from, to);
});
to.on('error', () => {
from.end(), to.end();
cleanUpSockets(from, to);
});
from.on('close', () => {
to.end();
cleanUpSockets(from, to);
});
to.on('close', () => {
cleanUpSockets(from, to);
});
from.on('timeout', () => {
cleanUpSockets(from, to);
});
to.on('timeout', () => {
cleanUpSockets(from, to);
});
from.on('end', () => {
cleanUpSockets(from, to);
})
to.on('end', () => {
cleanUpSockets(from, to);
})
})
.listen(portArg);
console.log(`PortProxy -> OK: Now listening on port ${portArg}`);