@feigi/fleet-ctl 3.30.24 → 3.30.25
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/package.json +1 -1
- package/scripts/board.mjs +13 -7
package/package.json
CHANGED
package/scripts/board.mjs
CHANGED
|
@@ -1647,11 +1647,12 @@ function bindFailure(server, port) {
|
|
|
1647
1647
|
// it. Linux refuses that bind outright; this check gives both the same answer.
|
|
1648
1648
|
// Resolves in bindFailure()'s vocabulary so the loop reads one shape: null
|
|
1649
1649
|
// when the connection is refused (nothing holds the port), an EADDRINUSE
|
|
1650
|
-
// error when it connects or times out, and any other error as itself
|
|
1651
|
-
// fault of its own, like EACCES on a bind
|
|
1652
|
-
//
|
|
1653
|
-
//
|
|
1654
|
-
//
|
|
1650
|
+
// error when it connects or times out, and any other error as itself,
|
|
1651
|
+
// marked `heldCheck` — a fault of its own, like EACCES on a bind, which the
|
|
1652
|
+
// loop reports as this check's rather than the bind's, whatever code the
|
|
1653
|
+
// error carries. A timeout counts as held because a live holder whose accept
|
|
1654
|
+
// backlog is full drops the SYN rather than refusing it. The window between
|
|
1655
|
+
// this check and the bind is a race the loop accepts, like its others.
|
|
1655
1656
|
function heldFailure(port) {
|
|
1656
1657
|
return new Promise((resolve) => {
|
|
1657
1658
|
const socket = connect({ host: COCKPIT_HOST, port });
|
|
@@ -1661,7 +1662,7 @@ function heldFailure(port) {
|
|
|
1661
1662
|
};
|
|
1662
1663
|
socket.setTimeout(PROBE_TIMEOUT_MS, held);
|
|
1663
1664
|
socket.once("connect", held);
|
|
1664
|
-
socket.once("error", (e) => resolve(e.code === "ECONNREFUSED" ? null : e));
|
|
1665
|
+
socket.once("error", (e) => resolve(e.code === "ECONNREFUSED" ? null : Object.assign(e, { heldCheck: true })));
|
|
1665
1666
|
});
|
|
1666
1667
|
}
|
|
1667
1668
|
|
|
@@ -1940,7 +1941,12 @@ export async function serve({ ledgerFile, port, interval, open, spendDir } = {})
|
|
|
1940
1941
|
// on a privileged port, EADDRNOTAVAIL on an unusable address, a pre-bind
|
|
1941
1942
|
// connect that fails with anything but ECONNREFUSED: those are faults of
|
|
1942
1943
|
// their own, and scanning past them would bury each one under an
|
|
1943
|
-
// exhausted-range message at the end that names the wrong problem.
|
|
1944
|
+
// exhausted-range message at the end that names the wrong problem. A bind
|
|
1945
|
+
// error dies with its own text; a held-check error dies naming the check,
|
|
1946
|
+
// which a raw connect message does not, and does so whatever code the
|
|
1947
|
+
// connect error carries: only a bare EADDRINUSE from the bind itself, or
|
|
1948
|
+
// the held signal heldFailure() resolves, means the port is taken.
|
|
1949
|
+
if (failure.heldCheck) die(`cannot check whether port ${candidate} is held: ${failure.message}`);
|
|
1944
1950
|
if (failure.code !== "EADDRINUSE") die(failure.message);
|
|
1945
1951
|
if (!scannable) die(`port ${candidate} in use — pass --port <n>`);
|
|
1946
1952
|
const holder = await probeCockpitWorkspace(candidate);
|