From 0c7c1a4446d29371cd698cafb7f1a065577fe274 Mon Sep 17 00:00:00 2001 From: Fredrik Lindberg Date: Thu, 31 Aug 2023 21:54:50 +0200 Subject: [PATCH] fix: variable scope --- src/tunnel/tunnel-service.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tunnel/tunnel-service.js b/src/tunnel/tunnel-service.js index 3aceb94..fe9d783 100644 --- a/src/tunnel/tunnel-service.js +++ b/src/tunnel/tunnel-service.js @@ -675,6 +675,7 @@ class TunnelService { return connection.transport.createConnection(ctx.opts, callback); } + let prev; do { const node = this._clusterService.getNode(next.node); if (node && !next.local) { @@ -690,9 +691,9 @@ class TunnelService { port: ctx.ingress.port, }, callback); } - const prev = next; + prev = next; next = this._tunnels.getNextConnection(tunnelId); - } while (next != undefined && next.id != prev.id); + } while (next != undefined && next.id != prev?.id); return false; }