mirror of
https://github.com/Flowseal/tg-ws-proxy.git
synced 2026-06-21 22:11:09 +03:00
#646 fixes
This commit is contained in:
+4
-1
@@ -275,6 +275,9 @@ async def _ws_keepalive(ws, interval: float):
|
||||
"""
|
||||
if interval <= 0:
|
||||
return
|
||||
|
||||
interval = max(1.0, interval) # reasonable minimum
|
||||
|
||||
try:
|
||||
while True:
|
||||
await asyncio.sleep(interval)
|
||||
@@ -354,7 +357,7 @@ async def bridge_ws_reencrypt(reader, writer, ws: RawWebSocket, label,
|
||||
|
||||
tasks = [asyncio.create_task(tcp_to_ws()),
|
||||
asyncio.create_task(ws_to_tcp())]
|
||||
keepalive = asyncio.ensure_future(
|
||||
keepalive = asyncio.create_task(
|
||||
_ws_keepalive(ws, proxy_config.ws_keepalive_interval))
|
||||
try:
|
||||
await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED)
|
||||
|
||||
@@ -633,7 +633,7 @@ def main():
|
||||
proxy_config.cfproxy_worker_domains = coerce_domain_list(args.cfproxy_worker_domain)
|
||||
proxy_config.fake_tls_domain = args.fake_tls_domain.strip()
|
||||
proxy_config.proxy_protocol = args.proxy_protocol
|
||||
proxy_config.ws_keepalive_interval = max(0.0, args.ws_keepalive)
|
||||
proxy_config.ws_keepalive_interval = max(0, args.ws_keepalive)
|
||||
|
||||
log_level = logging.DEBUG if args.verbose else logging.INFO
|
||||
log_fmt = logging.Formatter('%(asctime)s %(levelname)-5s %(message)s',
|
||||
|
||||
Reference in New Issue
Block a user