From cda52d8bd1856968f4b1ab2ef14010e0eb9951fa Mon Sep 17 00:00:00 2001 From: retoor Date: Mon, 16 Dec 2024 21:05:24 +0100 Subject: [PATCH] Update. --- src/shadowssh/__main__.py | 7 +++++++ src/shadowssh/app.py | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/shadowssh/__main__.py b/src/shadowssh/__main__.py index b9186fd..71c51ff 100644 --- a/src/shadowssh/__main__.py +++ b/src/shadowssh/__main__.py @@ -1,5 +1,6 @@ import argparse import asyncio +from concurrent.futures import ThreadPoolExecutor as Executor from shadowssh.app import Application @@ -19,6 +20,12 @@ def parse_args(): def serve(): args = parse_args() app = Application() + + executor = Executor(max_workers=500) + + loop = asyncio.get_event_loop() + loop.set_default_executor(executor) + asyncio.run( app.serve( args.host, diff --git a/src/shadowssh/app.py b/src/shadowssh/app.py index 3c94d02..38befb6 100644 --- a/src/shadowssh/app.py +++ b/src/shadowssh/app.py @@ -25,7 +25,7 @@ class Application(BaseApplication): super().__init__(*args, **kwargs) async def connect(self, host, port): - log.info(f"Connected to {host}:{port}.") + log.info(f"Forwarding to {host}:{port}.") reader, writer = await asyncio.open_connection(host, port) return reader, writer @@ -34,7 +34,7 @@ class Application(BaseApplication): chunk = await reader.read(BUFFER_SIZE) if not chunk: writer.close() - log.info("Forward connection closed.") + log.debug("Forward connection closed.") return writer.write(chunk) await writer.drain()