espressif: always make new client sockets be non-blocking #7455
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.
Fixes #7431.
accept()
was not set toO_NON_BLOCK
all the time, causing it to block until a request was made. Now ensure that it is always set to non-blocking.Other fixes:
write()
s toeventfd
s should always be 8 bytes. There was a write that was only 4 bytes (writing thefd
). This should actually return an error, but it wasn't checked. @tannewt I don't see that the results of these writes are used anywhere, so I think this change is OK, but you can take a look. Internally they are added to a counter associated with theeventfd
.I tested this on a Metro ESP32-S2, and saw that requests from Chrome were not hanging. It is also now possible to ctrl-C the
HTTPServer
. Before this fix, it was blocking internally on anlwip_recv()
, and could not be interrupted.Also tested the web workflow, which seems to work the same as before. Using
HTTPServer
on port 80 can cause issues with the web workflow, as might be expected, but these issues are not worse with this fix.@yousafs and @michalpokusa and anyone else: testing appreciated.
I think this makes adafruit/Adafruit_CircuitPython_HTTPServer#32 not be needed.