fix(hosts): bound encrypted overload and initial acquisition

Check encrypted wire capacity before the async channel converts a resource limit into a physical connection error. Bound initial routed acquisition with the existing client timeout, then enable reconnect after admission.
This commit is contained in:
Mohamed Boudra
2026-10-20 07:59:01 +02:00
parent 5ab9b8dcd4
commit 4e2aa97a74
6 changed files with 126 additions and 8 deletions
@@ -753,6 +753,7 @@ test("disposing an origin during routed handshake settles acquisition and closes
connections++;
socket.on("message", (data) => {
const frame = JSON.parse(data.toString());
if (frame.type === "ping") socket.send(JSON.stringify({ type: "pong" }));
if (frame.type === "hello")
socket.send(
JSON.stringify({
@@ -808,6 +809,17 @@ test("disposing an origin during routed handshake settles acquisition and closes
await expect.poll(() => routeClosed).toBe(true);
expect(ws.clients.size).toBe(1);
expect(connections).toBe(1);
routeClosed = false;
const next = await api(a);
await expect(next.paseo.hosts.client("srv_pending")).rejects.toMatchObject({
code: "host_offline",
serverId: "srv_pending",
});
await expect.poll(() => routeClosed).toBe(true);
expect(ws.clients.size).toBe(1);
expect(connections).toBe(1);
expect((await next.paseo.workspaces.list()).entries).toEqual([]);
expect((await next.paseo.hosts.list()).hosts[0]?.status).toBe("online");
});
test("source-key registration remains idempotent at directory capacity", async () => {