From deea23bbe99db9d13d29f46afad5ebee019e5f9a 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 0c40953863..aea1c27632 100644 --- a/src/connection-manager/index.ts +++ b/src/connection-manager/index.ts @@ -649,7 +649,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