From 6812ac19cf561479ed0c944c92b1d9d29e79bc00 Mon Sep 17 00:00:00 2001 From: chad Date: Thu, 8 Dec 2022 16:50:52 -0500 Subject: [PATCH] fix: should not prune a peer that is in the allow list once the connection limit is reached (#1515) --- src/connection-manager/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/connection-manager/index.ts b/src/connection-manager/index.ts index fb1e885cfa..7ecf6e6ada 100644 --- a/src/connection-manager/index.ts +++ b/src/connection-manager/index.ts @@ -690,7 +690,15 @@ export class DefaultConnectionManager extends EventEmitter { + return ma.getPeerId() === connection.remotePeer.toString() + }) + + // Connections in the allow list should be excluded from pruning + if (!connectionInAllowList) { + toClose.push(connection) + } if (toClose.length === toPrune) { break