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:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user