Keep the delivery-receipt merges across a reconnect instead of dropping them

This commit is contained in:
2026-08-28 14:44:32 +02:00
parent 30e0cfd38a
commit f4e55909a1
4 changed files with 101 additions and 15 deletions
+10 -2
View File
@@ -228,6 +228,8 @@ export class Session extends EventEmitter<SessionEvents> {
close(): void {
this.reconnectLoop?.stop();
this.teardown();
// Held across a drop instead: the peer never resends a receipt this session already answered.
this.dlrMerger.clear();
}
private loopFor(reconnect: ReconnectOptions | undefined): ReconnectLoop | undefined {
@@ -316,7 +318,6 @@ export class Session extends EventEmitter<SessionEvents> {
this.closed = true;
this.timers.clear();
this.pending.settleAll(new Error('Session closed before a response arrived'));
this.dlrMerger.clear();
this.incoming.clear();
this.sock.destroy();
this.emit('close');
@@ -406,6 +407,13 @@ export class Session extends EventEmitter<SessionEvents> {
private onClose(): void {
this.teardown();
this.reconnectLoop?.schedule();
if (this.reconnectLoop && !this.reconnectLoop.isStopped()) {
this.reconnectLoop.schedule();
return;
}
this.dlrMerger.clear();
}
}