From 0eba2b4c2bf9ddd65c1780b76312416c3d682ca4 Mon Sep 17 00:00:00 2001 From: BCCSTeam Date: Mon, 20 Nov 2023 23:12:22 +0100 Subject: [PATCH 1/5] * fixed wrong handeling of expectSingleResponse in broadcast-operator.ts --- lib/broadcast-operator.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/broadcast-operator.ts b/lib/broadcast-operator.ts index 255f52ded7..c5b76c5728 100644 --- a/lib/broadcast-operator.ts +++ b/lib/broadcast-operator.ts @@ -237,7 +237,7 @@ export class BroadcastOperator timedOut = true; ack.apply(this, [ new Error("operation has timed out"), - this.flags.expectSingleResponse ? null : responses, + this.flags.expectSingleResponse ? responses[0] : responses, ]); }, this.flags.timeout); @@ -254,7 +254,7 @@ export class BroadcastOperator clearTimeout(timer); ack.apply(this, [ null, - this.flags.expectSingleResponse ? null : responses, + this.flags.expectSingleResponse ? responses[0] : responses, ]); } }; From 5ddac18fefdf2cbbfb5555fb87b9b84440b9ae76 Mon Sep 17 00:00:00 2001 From: BCCSTeam Date: Sat, 25 Nov 2023 01:35:30 +0100 Subject: [PATCH 2/5] * fixed wrong handeling of expectSingleResponse in broadcast-operator.ts --- lib/broadcast-operator.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/broadcast-operator.ts b/lib/broadcast-operator.ts index c5b76c5728..5794edd9ef 100644 --- a/lib/broadcast-operator.ts +++ b/lib/broadcast-operator.ts @@ -252,10 +252,14 @@ export class BroadcastOperator responses.length === expectedClientCount ) { clearTimeout(timer); - ack.apply(this, [ - null, - this.flags.expectSingleResponse ? responses[0] : responses, - ]); + if (this.flags.expectSingleResponse) + ack.apply(this, responses); + + else + ack.apply(this, [ + null, + responses + ]); } }; From de31432a132c3488859660af18bf678e3e91adf0 Mon Sep 17 00:00:00 2001 From: BCCSTeam Date: Sat, 25 Nov 2023 11:37:05 +0100 Subject: [PATCH 3/5] * fix formatting with prettier --- lib/broadcast-operator.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/broadcast-operator.ts b/lib/broadcast-operator.ts index 5794edd9ef..8cd6149704 100644 --- a/lib/broadcast-operator.ts +++ b/lib/broadcast-operator.ts @@ -252,14 +252,8 @@ export class BroadcastOperator responses.length === expectedClientCount ) { clearTimeout(timer); - if (this.flags.expectSingleResponse) - ack.apply(this, responses); - - else - ack.apply(this, [ - null, - responses - ]); + if (this.flags.expectSingleResponse) ack.apply(this, responses); + else ack.apply(this, [null, responses]); } }; From 43e53225a46df392853837996dd51d83068fde59 Mon Sep 17 00:00:00 2001 From: BCCSTeam Date: Mon, 27 Nov 2023 20:43:56 +0100 Subject: [PATCH 4/5] * fix returning just the first response on a expected single response --- lib/broadcast-operator.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/broadcast-operator.ts b/lib/broadcast-operator.ts index 8cd6149704..4680f13e3d 100644 --- a/lib/broadcast-operator.ts +++ b/lib/broadcast-operator.ts @@ -252,7 +252,7 @@ export class BroadcastOperator responses.length === expectedClientCount ) { clearTimeout(timer); - if (this.flags.expectSingleResponse) ack.apply(this, responses); + if (this.flags.expectSingleResponse) ack.apply(this, responses[0]); else ack.apply(this, [null, responses]); } }; From 082aebd4c57f3766567327b1275585efe992881d Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Tue, 2 Jan 2024 16:01:33 +0100 Subject: [PATCH 5/5] cleanup --- lib/broadcast-operator.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/broadcast-operator.ts b/lib/broadcast-operator.ts index 4680f13e3d..48e295cb78 100644 --- a/lib/broadcast-operator.ts +++ b/lib/broadcast-operator.ts @@ -237,7 +237,7 @@ export class BroadcastOperator timedOut = true; ack.apply(this, [ new Error("operation has timed out"), - this.flags.expectSingleResponse ? responses[0] : responses, + this.flags.expectSingleResponse ? null : responses, ]); }, this.flags.timeout); @@ -252,8 +252,10 @@ export class BroadcastOperator responses.length === expectedClientCount ) { clearTimeout(timer); - if (this.flags.expectSingleResponse) ack.apply(this, responses[0]); - else ack.apply(this, [null, responses]); + ack.apply(this, [ + null, + this.flags.expectSingleResponse ? responses[0] : responses, + ]); } };