Commit Graph

10 Commits

Author SHA1 Message Date
00e2232e40 chore: reformat argparse arguments and fix import ordering in app.py and __main__.py 2024-12-18 04:57:06 +00:00
1a79ba252a fix: correct connection count variable in upstream connect/disconnect log messages and fix writer close ordering 2024-12-18 03:27:12 +00:00
0a7aa5babb perf: replace per-connection counter with total counter in handle_client to fix connection numbering
The diff changes the assignment of `connection_nr` from `self.connection_count` (which resets on each new connection batch) to `self.total_connection_count` (which monotonically increases). This ensures each connection receives a unique, ever-increasing identifier rather than reusing numbers from previous cycles, preventing confusion in logs and debugging under high concurrency.
2024-12-18 03:20:09 +00:00
65e9027676 perf: disable debug logging and remove print statements in Socket and Application classes
Remove debug=True default parameter from Socket.__init__ and set it to False to reduce I/O overhead. Delete two print statements ("Bef read" and "Aff read") from the Application class request handling loop, and remove commented-out connection keep-alive logic to streamline execution path for high-concurrency throughput.
2024-12-18 03:15:57 +00:00
6d671d0ee3 perf: raise thread pool to 2500 and buffer to 4096 with configurable backlog in serve methods
The thread count is increased from 500 to 2500 and buffer size from 64 to 4096 in the application constants. The `serve_async` and `serve` methods now accept an optional `backlog` parameter defaulting to `ZAMENYAT_BACKLOG=100`, which is passed to `asyncio.start_server` for improved connection queue management under high load.
2024-12-18 03:14:00 +00:00
92c0cf5058 feat: reduce buffer size and add debug mode to async reader/writer classes
- Decrease ZAMENYAT_BUFFER_SIZE from 8192 to 64 bytes for finer-grained I/O control
- Add optional debug parameter to AsyncWriter and AsyncReader constructors
- Implement read_until method in AsyncReader for delimiter-based message parsing
- Print chunk data to stdout when debug flag is enabled in both read and write operations
2024-12-18 03:02:56 +00:00
03f3fc5420 fix: restore websocket connection handling and reconnection logic 2024-12-18 02:09:37 +00:00
55d7eedd0e feat: add AsyncReader/AsyncWriter buffered I/O wrappers and Socket class in app.py
Introduces AsyncReader and AsyncWriter classes that wrap asyncio reader/writer pairs with configurable buffer sizes and chunked write draining. Also adds a Socket class combining both wrappers for unified stream handling. These changes support more granular control over network I/O in high-latency environments.
2024-12-18 01:42:16 +00:00
a85433df6e feat: add initial project scaffold with Makefile, pyproject.toml, setup.cfg, and CLI entry point
Create the foundational project structure for the zamenyat HTTP content replacement bridge, including a Makefile with targets for environment setup, installation, formatting, and building; a pyproject.toml declaring setuptools as the build backend; a setup.cfg with package metadata, dependencies on the internal app library, and a console_scripts entry point; a README.md with a corrected heading and project description; a __main__.py module implementing argument parsing for host, port, upstream-host, and upstream-port; and an app.py module defining the Application class with async header parsing, connection tracking, and configurable buffer/header size constants.
2024-12-17 21:49:51 +00:00
c74422583b feat: add initial project scaffolding with .gitignore, MIT license, and README
Introduce the foundational project structure for zamenyat, an HTTP bridge for content replacement. The .gitignore excludes Python bytecode, build artifacts, virtual environments, and IDE files. The LICENSE file applies the MIT license with copyright assigned to retoor. The README describes the project as a configurable HTTP bridge enabling content substitution, such as serving real and anonymous versions of a website.
2024-12-17 18:27:09 +00:00