From e39cece717254ed9c066a1191278168bdda3284b Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 28 Sep 2026 11:21:06 +0200 Subject: [PATCH] Call the onRequest hook unbound, as the session did --- src/incoming-requests.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/incoming-requests.ts b/src/incoming-requests.ts index b4df313..9c3d375 100644 --- a/src/incoming-requests.ts +++ b/src/incoming-requests.ts @@ -97,8 +97,10 @@ export class IncomingRequests { async handle(pduObj: PduObject): Promise { const generation = this.linkGeneration; + const { onRequest } = this; - if (this.onRequest && await this.onRequest(this.session, pduObj)) return; + // Called unbound, so the application's hook never sees this class as its `this`. + if (onRequest && await 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) {