Commit Graph

6 Commits

Author SHA1 Message Date
2e899e7241 Update Worker Server
fix: resolve tunnel cleanup issues and prevent Max tunnels reached errors

- Fixed `tunnelServer.destroy is not a function` error by removing invalid call and adding proper socket cleanup
- Improved tunnel closure reliability with explicit client socket tracking and destruction
- Reduced `TUNNEL_FORCE_CLOSE_MS` to 10s and `TUNNEL_TIMEOUT` to 20s for faster cleanup
- Increased `MAX_TUNNELS` to 1000 to handle high load
- Enhanced debugging with socket connection counts and periodic tunnel diagnostics
- Ensured robust cleanup in all error paths to prevent resource leaks
- Maintained tunnel isolation, speed, and stability in single-file structure
2025-06-06 18:49:08 -04:00
ff27041513 Worker Server Update - Adding Websocket Support
Add WebSocket support for long-running connections

- Implement WebSocket upgrade handling to support persistent connections
- Establish unique tunnels for each WebSocket connection
- Clean up tunnels upon WebSocket disconnect
- Maintain existing HTTP request functionality
2024-11-08 02:06:12 -05:00
f31c52a4f2 Update Worker Server
Isolated Tunnels per Request:

Each HTTP request now generates a unique tunnel server instance. This avoids potential cross-request data confusion by ensuring that no tunnel is reused across multiple requests.
Port Availability Check with getAvailablePort:

Enhanced the getAvailablePort function to check if a randomly generated port is available before using it. The function now creates a temporary server on each port to ensure it’s free, retrying until an available port is found. This prevents EADDRINUSE errors caused by attempting to bind to a port already in use.
Automatic Tunnel Closure:

Each tunnel server (tunnelServer) is configured to close automatically after the corresponding request’s response is completed. The res.on('finish') event handler triggers tunnelServer.close() to release the resources immediately, preventing any chance of accidental reuse.
Removed tunnels Object:

Since each tunnel is now temporary and used for only one request, we removed the need to track tunnels in a tunnels object. This simplifies the code and helps ensure tunnels are created and destroyed within the scope of a single request.
2024-11-07 18:49:56 -05:00
479e0d8863 fix worker count 2024-03-29 03:09:48 -04:00
e479133a4a fix 404.txt 2024-03-29 03:00:56 -04:00
c51c98aacd first commit 2024-03-29 02:43:46 -04:00