Name what each of the three request paths skips
Test / lint (pull_request) Successful in 23s
Test / test (18) (pull_request) Successful in 31s
Test / test (20) (pull_request) Successful in 31s
Test / test (22) (pull_request) Successful in 31s
Test / test (24) (pull_request) Successful in 31s
Test / test (26) (pull_request) Successful in 32s
Mirror / push (push) Successful in 6s

This commit was merged in pull request #44.
This commit is contained in:
2026-09-28 10:42:18 +02:00
parent 469a91b9bb
commit 1aadcbe3c9
4 changed files with 29 additions and 32 deletions
+9 -6
View File
@@ -93,11 +93,11 @@ export class OutgoingRequests {
return Promise.resolve({ err: new Error('Session is shutting down') });
}
return this.carry(input, options);
return this.requestPastDrain(input, options);
}
/** The same path without the drain's refusal, which a receipt for a held message has to take. */
async carry(
/** request() without the drain's refusal, which a receipt for a held message has to take. */
async requestPastDrain(
input: PduObjectInput,
options: SendOptions,
): Promise<Result<{ pduObj: PduObject }>> {
@@ -109,7 +109,7 @@ export class OutgoingRequests {
if (bindCommands.includes(input.cmdName)) {
const shut = this.gate.refusal();
return shut ? { err: shut } : this.now(input, options);
return shut ? { err: shut } : this.requestPastDrainGateAndWindow(input, options);
}
const waitForLink = this.gate.hold(options.signal);
@@ -129,8 +129,11 @@ export class OutgoingRequests {
}
}
/** Past the gate, the window and a drain, for what has to go out either way. */
async now(input: PduObjectInput, options: SendOptions = {}): Promise<Result<{ pduObj: PduObject }>> {
/** Straight onto the current link, for what has to go out either way. */
async requestPastDrainGateAndWindow(
input: PduObjectInput,
options: SendOptions = {},
): Promise<Result<{ pduObj: PduObject }>> {
return (await this.attempt(input, options)).result;
}
+2 -3
View File
@@ -235,9 +235,8 @@ export class Session extends EventEmitter<SessionEvents> {
async unbind(): Promise<VoidResult> {
const drained = await this.drain(undefined);
const wasOpen = this.lifecycle === 'attached';
// now(), not send(): a drain refuses a send, and the unbind goes out either way.
const sent = wasOpen
? await this.outgoing.now({ cmdName: 'unbind' })
? await this.outgoing.requestPastDrainGateAndWindow({ cmdName: 'unbind' })
: { err: new Error('Session is closed') };
const closedOnUnbind = wasOpen && this.lifecycle !== 'attached';
@@ -274,7 +273,7 @@ export class Session extends EventEmitter<SessionEvents> {
reportError: err => { this.emit('sessionError', err); },
reportMessageDlr: merged => { this.emit('messageDlr', merged); },
send: input => this.send(input),
sendPastDrain: input => this.outgoing.carry(input, {}),
sendPastDrain: input => this.outgoing.requestPastDrain(input, {}),
smsListeners: () => this.listenerCount('sms'),
};
}