bdy 1.22.5-dev → 1.22.7-dev

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.22.5-dev",
4
+ "version": "1.22.7-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {
@@ -25,6 +25,7 @@ class AgentManagerClass {
25
25
  agent;
26
26
  ws;
27
27
  server;
28
+ connections;
28
29
  system;
29
30
  constructor() {
30
31
  this.status = tunnel_1.TUNNEL_AGENT_STATUS.DISABLED;
@@ -36,6 +37,7 @@ class AgentManagerClass {
36
37
  this.agent = null;
37
38
  this.server = null;
38
39
  this.ws = null;
40
+ this.connections = new Set();
39
41
  if ((0, utils_1.isOsx)()) {
40
42
  this.system = new osx_1.default();
41
43
  }
@@ -57,9 +59,9 @@ class AgentManagerClass {
57
59
  this.ws.close();
58
60
  }
59
61
  if (this.server) {
60
- this.server.closeAllConnections();
62
+ this.connections.forEach((socket) => socket.resetAndDestroy());
61
63
  this.server.close(() => {
62
- process.exit();
64
+ process.exit(0);
63
65
  });
64
66
  }
65
67
  setTimeout(() => process.exit(0), 1000);
@@ -544,6 +546,10 @@ class AgentManagerClass {
544
546
  }
545
547
  createServer() {
546
548
  this.server = http_1.default.createServer((req, res) => this.processRequest(req, res));
549
+ this.server.on('connection', (socket) => {
550
+ this.connections.add(socket);
551
+ socket.on('close', () => this.connections.delete(socket));
552
+ });
547
553
  const { WebSocketServer: WsServer } = require('ws');
548
554
  this.ws = new WsServer({ noServer: true });
549
555
  this.ws.on('connection', (con, id) => this.processWebsocketConnection(con, id));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bdy",
3
3
  "preferGlobal": false,
4
- "version": "1.22.5-dev",
4
+ "version": "1.22.7-dev",
5
5
  "type": "commonjs",
6
6
  "license": "MIT",
7
7
  "scripts": {