From 2942f48ded1f0e7dd74e261edeea43461c49dc7a Mon Sep 17 00:00:00 2001 From: Bram Kelchtermans Date: Wed, 4 Nov 2026 11:31:32 +0100 Subject: [PATCH] maybe now the max conns work? --- Dockers/xtream-proxy/src/config.js | 9 ++------- Dockers/xtream-proxy/src/upstream-pool.js | 21 ++------------------- Dockers/xtream-proxy/src/upstream.js | 3 +-- 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/Dockers/xtream-proxy/src/config.js b/Dockers/xtream-proxy/src/config.js index 6e4b392..54fc516 100644 --- a/Dockers/xtream-proxy/src/config.js +++ b/Dockers/xtream-proxy/src/config.js @@ -77,7 +77,7 @@ function readConfigEntries() { } for (const url of validUrls) { - entries.push({ url, username, password, entryId: index }); + entries.push({ url, username, password }); } }); return entries; @@ -102,12 +102,7 @@ function reloadConfig() { seen.add(upstream.key); const existing = previous.get(upstream.key); - if (existing) { - existing.entryId = upstream.entryId; - next.push(existing); - } else { - next.push(upstream); - } + next.push(existing || upstream); } const removed = upstreams.filter((u) => !seen.has(u.key)).length; diff --git a/Dockers/xtream-proxy/src/upstream-pool.js b/Dockers/xtream-proxy/src/upstream-pool.js index b93cbda..2efc181 100644 --- a/Dockers/xtream-proxy/src/upstream-pool.js +++ b/Dockers/xtream-proxy/src/upstream-pool.js @@ -26,30 +26,13 @@ function isBusy(upstream) { } function totalConnectionCapacity() { - const perEntry = new Map(); + let total = 0; for (const upstream of getUpstreams()) { - const entryId = upstream.entryId ?? upstream.key; - const current = perEntry.get(entryId); const maxCons = upstream.state.maxCons; - - if (!current) { - perEntry.set(entryId, { maxCons }); - continue; - } - - if (maxCons !== null && maxCons > 0) { - current.maxCons = - current.maxCons === null || current.maxCons <= 0 - ? maxCons - : Math.max(current.maxCons, maxCons); - } - } - - let total = 0; - for (const { maxCons } of perEntry.values()) { total += maxCons !== null && maxCons > 0 ? maxCons : 1; } + return total; } diff --git a/Dockers/xtream-proxy/src/upstream.js b/Dockers/xtream-proxy/src/upstream.js index 6233787..6d47cfd 100644 --- a/Dockers/xtream-proxy/src/upstream.js +++ b/Dockers/xtream-proxy/src/upstream.js @@ -19,7 +19,7 @@ function baseState() { } class Upstream { - constructor({ url, username, password, entryId }) { + constructor({ url, username, password }) { const parsed = new URL(url); parsed.hash = ''; parsed.search = ''; @@ -27,7 +27,6 @@ class Upstream { this.basePath = parsed.pathname.replace(/\/+$/, ''); this.username = username; this.password = password; - this.entryId = entryId; this.key = `${parsed.origin}${this.basePath}|${username}|${password}`; this.state = { ...baseState(), inFlight: 0 }; }