From bfd0ed1b985f41736b5e633c96ab5b6d589077b2 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 28 Sep 2026 01:34:55 +0200 Subject: [PATCH] Say only what canCarry() and droppedWhileDraining() can know --- src/outgoing-requests.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/outgoing-requests.ts b/src/outgoing-requests.ts index 51366e7..80939d5 100644 --- a/src/outgoing-requests.ts +++ b/src/outgoing-requests.ts @@ -51,12 +51,11 @@ export class OutgoingRequests { this.window = new SendWindow({ limit: options.maxOutstanding, log: options.log }); } - /** Whether a request made now reaches the socket. Read through a method: a drop can land while one awaits. */ canCarry(): boolean { return this.gate.isUp() && !this.transport.sock.destroyed; } - /** The link went while draining, so the teardown settled what the drain waited on, not the peer. */ + /** The link went before the drain finished, so an empty window says nothing about the peer. */ droppedWhileDraining(): boolean { return this.draining && !this.canCarry(); } @@ -89,7 +88,7 @@ export class OutgoingRequests { if (wrong) return Promise.resolve({ err: wrong }); - // With no link, the gate answers instead, and says closed. + // With no link, the request is refused as closed further on. if (this.draining && this.canCarry()) { return Promise.resolve({ err: new Error('Session is shutting down') }); }