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