From d2b6c450ebe914d614bd7706a68d5404d2f7c771 Mon Sep 17 00:00:00 2001 From: Flowseal Date: Thu, 3 Sep 2026 05:11:03 +0300 Subject: [PATCH] TODOs --- proxy/pool.py | 3 +++ proxy/tg_ws_proxy.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/proxy/pool.py b/proxy/pool.py index 04ed558..2d08b7f 100644 --- a/proxy/pool.py +++ b/proxy/pool.py @@ -14,11 +14,14 @@ from .utils import ws_domains, DC_DEFAULT_IPS log = logging.getLogger('tg-mtproto-proxy') +# TODO: domains handling is completely broken: wrong is_media flag causes tcp_reset, +# but initial connection is still established no matter what is is_media flag is set to class _WsPool: WS_POOL_MAX_AGE = 120.0 WS_POOL_CHECK_INTERVAL = 5.0 REFILL_BACKOFF_INITIAL = 60.0 REFILL_BACKOFF_MAX = 3600.0 + # TODO: Lower refill backoff timer def __init__(self): self._idle: Dict[Tuple[int, bool], deque] = {} diff --git a/proxy/tg_ws_proxy.py b/proxy/tg_ws_proxy.py index 51f4987..51e43ad 100644 --- a/proxy/tg_ws_proxy.py +++ b/proxy/tg_ws_proxy.py @@ -339,6 +339,10 @@ async def _handle_client(reader, writer, secret: bytes): ws_timed_out = False all_redirects = True + # TODO: Sometimes connection is established, and sometimes its timed out + # So we don't need to fully restrict pool refill, let it try connecting + # in the background. May be remove direct connection there completely and + # only use pool for them? But need to fix domains handling first allow_pool_refill = now >= ip_fail_until.get(target, 0) ws = await ws_pool.get( dc, is_media, target, domains,