Connection handling improvements, measurements for dimensioning#6
Merged
Conversation
Owner
szeka9
commented
Apr 11, 2026
- improved module naming
- use context manager and prevent the use of stale connection objects
- reject incomplete HTTP requests if the client sends EOF
- remove main() from http_server and allow applications to directly take control of the asyncio event loop with asyncio.run()
- create dimensioning guide and measurements for ESP32-S3 and ESP32-C3
Rename socket_http.py to http_connection.py and socket.py to connection.py to to reflect that these classes wrap asyncio streams rather than raw sockets. Rename parent module for connectivity related modules from 'con' to 'connectivity'.
Add context manager to BaseConnection to simplify closing asyncio StreamWriter for active socket connections. Rename reader and writer members of the BaseConnection class to indicate that these are not public members. Additionally, add connection checking to the public read(), write() and close() methods to prevent reusing stale connection objects (e.g. when the asyncio server is terminated asynchronously while there are active connections).
Currently, the server waits until a proper state machine termination or timeout exception, not addressing the case when a client sends an incomplete request. Instead, respond with HTTP 400 when EOF is received before the state machine is properly terminated.
Remove main() from the HTTP server module, invoke asyncio.run() in boot.py to initiate the event loop. Update Makefile and documentation about app deployment. Instead of using mpremote run, always deploy app.py and boot.py to the device. Also, update the default list of rules.
Only delete project-related files, use more robust error handling to prevent partial cleanups.
This commit includes new automations for system testing focusing on heap usage with respect to feature enablement. Additionally, add documentation and measurement for dimensioning on ESP32-S3 and ESP32-C3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.