Drop a request whose link went while onRequest ran, and pin the wire in the test

This commit is contained in:
2026-09-01 20:40:17 +02:00
parent c8d265d5fa
commit e6250ef44e
5 changed files with 42 additions and 13 deletions
+5 -1
View File
@@ -39,7 +39,6 @@ export class IncomingRequests {
private readonly session: Session;
private readonly smsIdFormat: SmsIdFormat;
private readonly systemId: string;
/** Bumped when a link goes, so a message from an earlier one knows its answer cannot correlate. */
private linkGeneration = 0;
constructor(options: IncomingRequestsOptions) {
@@ -64,8 +63,13 @@ export class IncomingRequests {
}
async handle(pduObj: PduObject): Promise<void> {
const generation = this.linkGeneration;
if (this.onRequest && await this.onRequest(this.session, pduObj)) return;
// The link it arrived on went while the hook ran, so nothing we answer now correlates.
if (this.linkGeneration !== generation) return;
if (!this.session.bindAllows(pduObj.cmdName)) {
this.log.info('session - command the peer\'s bind direction does not carry', {
bindType: this.session.boundAs ?? '',