feat: cap concurrent connections with semaphore
Add max_connections config (default 256) with -m/--max-connections CLI flag. Server wraps on_client in asyncio.Semaphore to prevent fd exhaustion under load. Value reloads on SIGHUP; active connections drain normally. Also adds pool_size/pool_max_idle config fields and first_hop_pool wiring in server.py (used by next commits), and fixes asyncio.TimeoutError -> TimeoutError lint warnings.
This commit is contained in:
@@ -5,6 +5,9 @@ listen: 127.0.0.1:1080
|
||||
timeout: 10
|
||||
retries: 3 # max attempts per connection (proxy_source only)
|
||||
log_level: info
|
||||
# max_connections: 256 # max concurrent client connections (backpressure)
|
||||
# pool_size: 0 # pre-warmed TCP connections to first hop (0 = disabled)
|
||||
# pool_max_idle: 30 # max idle time (seconds) for pooled connections
|
||||
|
||||
# Proxy chain -- connections tunnel through each hop in order.
|
||||
# Supported protocols: socks5://, socks4://, http://
|
||||
|
||||
Reference in New Issue
Block a user