From cc7c7c8edf715c7fd18b5dbdc46075caddcd6648 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 1 Feb 2023 04:41:45 -0500 Subject: [PATCH] *Only run loop while this._activeRelay is not set --- src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 6294e53..18e1bf0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -76,7 +76,7 @@ export default class HyperswarmWeb extends EventEmitter { this._activeRelay.on("close", () => { this._activeRelay = undefined; }); - } while (relays.length > 0); + } while (relays.length > 0 && !this._activeRelay); if (!this._activeRelay) { throw new Error("Failed to find an available relay");