From cb16b87b73e104aa2e6ad3dad1b827cb0a85243a Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Tue, 26 Jul 2022 23:13:30 -0400 Subject: [PATCH] Revert "*Store copy of activeRelay size to prevent infinite loop" This reverts commit 7cb32b716ac677502260c3de5b956c81e029c789. --- src/index.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/index.ts b/src/index.ts index 7c891fc..56084ac 100644 --- a/src/index.ts +++ b/src/index.ts @@ -130,12 +130,9 @@ export default class DHT { if (0 === available.length) { return; } - - const activeRelays = this._activeRelays.size; - while ( this._activeRelays.size <= - Math.min(this._maxConnections, available.length + activeRelays) + Math.min(this._maxConnections, available.length + this._activeRelays.size) ) { const relayIndex = await randomNumber(0, available.length - 1);