Support hosted builds against Arduino-Emulator#420
Support hosted builds against Arduino-Emulator#420mathieucarbou merged 21 commits intoESP32Async:mainfrom
Conversation
* Factors the locking into one place * Adds "|| defined(HOST)" as needed elsewhere * Adds "override" in a few places where it was missing
There was a problem hiding this comment.
Pull request overview
This PR improves hosted/POSIX build compatibility (Arduino-Emulator) by expanding HOST platform guards, centralizing locking primitives, and tightening virtual overrides across the async webserver components.
Changes:
- Add
HOSTto platform-specific include/behavior guards (WiFi, MD5, String clearing paths, TCP backends). - Factor ESP32-style locking into shared macros and apply them consistently in WebSocket and SSE (EventSource) code paths.
- Add missing
overridespecifiers for response implementations.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/WebServer.cpp | Include WiFi.h under HOST to support hosted builds. |
| src/WebRequest.cpp | Treat HOST like certain embedded cores for _temp clearing behavior. |
| src/WebAuthentication.cpp | Add missing include and extend MD5 implementation selection to HOST. |
| src/ESPAsyncWebServer.h | Guard lwIP include for HOST; introduce shared locking macros; define __unused if missing. |
| src/AsyncWebSocket.h | Add HOST platform section; switch mutex members to shared locking macro; add overrides. |
| src/AsyncWebSocket.cpp | Replace ESP32-only mutex usage with shared lock macros; add hosted SHA1 backport include. |
| src/AsyncWebServerLogging.h | Disable framework logging macros for HOST. |
| src/AsyncEventSource.h | Add HOST to AsyncTCP include path; switch mutex members to shared locking macro; add overrides. |
| src/AsyncEventSource.cpp | Replace ESP32-only mutex usage with shared lock macros for queue/client-list protection. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@MitchBradley : thank you for your last updates :-) I have 2 more comments left. I will first merge #421, then you will be able to rebase this PR with the comments fixed and it will be ready to be merged. |
project must be compiled with lwip when using arduino emulator
|
@MitchBradley I fixed some compilation issues and added a CI workflow for Arduino-Emulator. I don't understand why you removed the inclusion of tcp_base lwip header for HOST: it is required since defines the tcp_stats enumerated type returned by asyncws. The right way is I think to compile the project with lwip. |
|
@MitchBradley : I added several commits to make sure the added feature work and that we can indeed compile with Arduino Emulator. I added a CI workflow for that also and an exemple in I will merge this PR because this still has some value, but if you can take time to send another one to complete this I am wondering if similar work should happen in AsyncTCP too. Thanks! |
|
http://github.com/MitchBradley/PosixAsyncTCP This effort was very tricky because it involved coordinated changes to so many different packages. I tried to break it down into isolated stages, but until all pieces were addressed, it was not easy to test the stages. |
Nice! So now that the PR is merged and we have a CI + example it should be easier to complete any testing you need. |
|
@MitchBradley : I also now understand why you attempted to remove the inclusion of lwip header, which I rolled back when adding a CI example.... I pushed a new PR to switch to your fork for the compilation: #423 |
This partially supersedes #416 , addressing only the topic of compatibility with Arduino-Emulator, without the emptyString part (already addressed) and without the on-close state machine fixes (to be addressed in a separate PR).