Split a retried drop out of close, and range-check the backoff

`close` fires only where nothing will bring the session back; a drop the
reconnect loop will retry is `disconnected`, pairing with `reconnected`.
`minDelay: 0` never doubles, so the backoff never started — both delays
are range-checked now, and only `false` spells reconnect off.
This commit is contained in:
2026-08-31 21:11:19 +02:00
parent 18177053bc
commit 880454b4f4
6 changed files with 111 additions and 8 deletions
+6 -1
View File
@@ -376,7 +376,12 @@ export class Session extends EventEmitter<SessionEvents> {
this.pending.settleAll(new Error('Session closed before a response arrived'));
this.incoming.clear();
this.sock.destroy();
this.emit('close');
this.emit(this.retrying() ? 'disconnected' : 'close');
}
/** A drop the loop will bring the session back from is a disconnect, not the end of it. */
private retrying(): boolean {
return this.reconnectLoop !== undefined && !this.reconnectLoop.isStopped();
}
private nextConcatReference(): number {