Retry a stream we cannot read, and cover the framer reset on attach

A framing or codec error tears the link down rather than the session, so
the loop retries it on a fresh socket with a fresh framer — which is what
a desynced stream needs. Removing that reset failed nothing before; the
reconnect test now leaves half a PDU on the dying link, and does.

`disconnected` counts failed links rather than outages, which the README
now says, and the transport wires its socket as it is built.
This commit is contained in:
2026-08-31 22:27:16 +02:00
parent b2d121b4f3
commit b1c790b9a0
7 changed files with 62 additions and 18 deletions
+6 -2
View File
@@ -163,9 +163,13 @@ function checkReconnect(reconnect: unknown): VoidResult {
// A delay of 0 never doubles, so the backoff never starts and every retry lands at once.
const checked = checkLimits([['maxDelay', maxDelay, 1], ['minDelay', minDelay, 1]]);
if (checked.err || maxDelay >= minDelay) return checked;
if (checked.err) return checked;
return { err: new Error(`maxDelay must be minDelay or more, got ${String(maxDelay)}`) };
if (maxDelay < minDelay) {
return { err: new Error(`maxDelay must be minDelay (${String(minDelay)}) or more, got ${String(maxDelay)}`) };
}
return {};
}
function isRecord(value: unknown): value is Record<string, unknown> {