rdsh-gateway 0.2.0 → 0.2.1

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.
package/dist/join.js CHANGED
@@ -105,6 +105,9 @@ export async function join(opts) {
105
105
  process.on("SIGINT", () => void shutdown("SIGINT"));
106
106
  process.on("SIGTERM", () => void shutdown("SIGTERM"));
107
107
  process.on("SIGHUP", () => void shutdown("SIGHUP"));
108
+ // 常驻:进程靠信号退出(shutdown 里 process.exit);防止函数返回后
109
+ // CLI 的 main().then(exit) 误退出服务进程
110
+ const keepAlive = new Promise(() => { });
108
111
  function handleFrame(frame, client) {
109
112
  switch (frame.type) {
110
113
  case FRAME_TYPE.PING: {
@@ -336,6 +339,7 @@ export async function join(opts) {
336
339
  });
337
340
  }
338
341
  connect();
342
+ await keepAlive;
339
343
  }
340
344
  function normalizeRespHeaders(headers) {
341
345
  const out = {};
package/dist/serve.js CHANGED
@@ -96,6 +96,9 @@ export async function serve(opts) {
96
96
  process.on("SIGINT", () => void shutdown("SIGINT"));
97
97
  process.on("SIGTERM", () => void shutdown("SIGTERM"));
98
98
  process.on("SIGHUP", () => void shutdown("SIGHUP"));
99
+ // 常驻:进程靠信号退出(shutdown 里 process.exit);防止函数返回后
100
+ // CLI 的 main().then(exit) 误退出服务进程
101
+ await new Promise(() => { });
99
102
  }
100
103
  function lanAddresses() {
101
104
  return Object.values(networkInterfaces())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rdsh-gateway",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "rdsh host-side component: LAN auth gateway + outbound tunnel endpoint (spawns dsh web)",
5
5
  "license": "MIT",
6
6
  "type": "module",