@threadbase-sh/streamer 1.52.1 → 1.52.3
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/README.md +8 -4
- package/dist/cli.cjs +22 -9
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +20 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +20 -8
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.cjs
CHANGED
|
@@ -14480,6 +14480,7 @@ var StreamerServer = class {
|
|
|
14480
14480
|
dbPool = null;
|
|
14481
14481
|
dbInstanceId = null;
|
|
14482
14482
|
disableDb = false;
|
|
14483
|
+
host;
|
|
14483
14484
|
// Skip the startup warm-up scan (test hook; see ServerConfig.skipStartupWarmup).
|
|
14484
14485
|
skipStartupWarmup;
|
|
14485
14486
|
autoResumeOnBoot;
|
|
@@ -14601,6 +14602,7 @@ var StreamerServer = class {
|
|
|
14601
14602
|
}
|
|
14602
14603
|
this.verbose = config.verbose ?? false;
|
|
14603
14604
|
this.disableDb = config.disableDb ?? false;
|
|
14605
|
+
this.host = config.host;
|
|
14604
14606
|
this.skipStartupWarmup = config.skipStartupWarmup ?? false;
|
|
14605
14607
|
this.autoResumeOnBoot = config.autoResumeOnBoot ?? false;
|
|
14606
14608
|
this.scanProfiles = config.scanProfiles;
|
|
@@ -15253,7 +15255,7 @@ var StreamerServer = class {
|
|
|
15253
15255
|
await runMigrations(this.dbPool);
|
|
15254
15256
|
this.log.info("Database migrations applied", { event: "db.migrations_applied" });
|
|
15255
15257
|
}
|
|
15256
|
-
await this.bindWithRetry(port);
|
|
15258
|
+
await this.bindWithRetry(port, this.host);
|
|
15257
15259
|
if (!this.ptyManager.isRemote()) {
|
|
15258
15260
|
this.idleReaperTimer = setInterval(() => this.reapIdleSessions(), IDLE_REAP_SWEEP_MS);
|
|
15259
15261
|
this.idleReaperTimer.unref?.();
|
|
@@ -15262,7 +15264,8 @@ var StreamerServer = class {
|
|
|
15262
15264
|
{
|
|
15263
15265
|
this.log.info(`Streamer server listening on port ${port}`, {
|
|
15264
15266
|
port,
|
|
15265
|
-
event: "server.listening"
|
|
15267
|
+
event: "server.listening",
|
|
15268
|
+
...this.host !== void 0 && { host: this.host }
|
|
15266
15269
|
});
|
|
15267
15270
|
try {
|
|
15268
15271
|
this.runtimeStore = RuntimeStore.open(this.runtimeDbPath);
|
|
@@ -15476,15 +15479,15 @@ var StreamerServer = class {
|
|
|
15476
15479
|
// Bind the HTTP listener, retrying on a transient EADDRINUSE. See the call
|
|
15477
15480
|
// site in listen() for why the race exists (kickstart -k relaunch). Total
|
|
15478
15481
|
// worst case ≈ 6 × 500 ms = 3 s before the final attempt rethrows.
|
|
15479
|
-
async bindWithRetry(port, attempts = 6, delayMs = 500) {
|
|
15482
|
+
async bindWithRetry(port, host, attempts = 6, delayMs = 500) {
|
|
15480
15483
|
this.binding = true;
|
|
15481
15484
|
try {
|
|
15482
|
-
await this.bindWithRetryLoop(port, attempts, delayMs);
|
|
15485
|
+
await this.bindWithRetryLoop(port, host, attempts, delayMs);
|
|
15483
15486
|
} finally {
|
|
15484
15487
|
this.binding = false;
|
|
15485
15488
|
}
|
|
15486
15489
|
}
|
|
15487
|
-
async bindWithRetryLoop(port, attempts, delayMs) {
|
|
15490
|
+
async bindWithRetryLoop(port, host, attempts, delayMs) {
|
|
15488
15491
|
for (let attempt = 1; attempt <= attempts; attempt++) {
|
|
15489
15492
|
try {
|
|
15490
15493
|
await new Promise((resolve2, reject) => {
|
|
@@ -15498,7 +15501,11 @@ var StreamerServer = class {
|
|
|
15498
15501
|
};
|
|
15499
15502
|
this.httpServer.once("error", onError);
|
|
15500
15503
|
this.httpServer.once("listening", onListening);
|
|
15501
|
-
|
|
15504
|
+
if (host === void 0) {
|
|
15505
|
+
this.httpServer.listen(port);
|
|
15506
|
+
} else {
|
|
15507
|
+
this.httpServer.listen(port, host);
|
|
15508
|
+
}
|
|
15502
15509
|
});
|
|
15503
15510
|
return;
|
|
15504
15511
|
} catch (err) {
|
|
@@ -15506,13 +15513,18 @@ var StreamerServer = class {
|
|
|
15506
15513
|
if (e.code === "EADDRINUSE" && attempt === attempts) {
|
|
15507
15514
|
this.log.error(
|
|
15508
15515
|
`port ${port} still busy (EADDRINUSE) after ${attempts} attempts; giving up`,
|
|
15509
|
-
{
|
|
15516
|
+
{
|
|
15517
|
+
port,
|
|
15518
|
+
attempts,
|
|
15519
|
+
event: "server.bind_failed",
|
|
15520
|
+
...host !== void 0 && { host }
|
|
15521
|
+
}
|
|
15510
15522
|
);
|
|
15511
15523
|
}
|
|
15512
15524
|
if (e.code !== "EADDRINUSE" || attempt === attempts) throw err;
|
|
15513
15525
|
this.log.debug?.(
|
|
15514
15526
|
`port ${port} busy (EADDRINUSE), retry ${attempt}/${attempts - 1} in ${delayMs}ms`,
|
|
15515
|
-
{ port, attempt, event: "server.bind_retry" }
|
|
15527
|
+
{ port, attempt, event: "server.bind_retry", ...host !== void 0 && { host } }
|
|
15516
15528
|
);
|
|
15517
15529
|
await new Promise((r) => setTimeout(r, delayMs));
|
|
15518
15530
|
}
|