match cpython recv timeout behavior. new httpserver example #125
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.
This PR has two primary chagnes:
This change is necessary in order to have the MiniMQTT library function as expected. Without this change when you call mqtt_client.loop() it will never return until actual data has been recieved. But it should be returning sooner based on the timeout behavior when there is no data.
This comment: adafruit/Adafruit_CircuitPython_ESP32SPI#167 (comment) contains CPython code snippets that illustrate the timeout behavior of the socket. The changes in this PR will make the wiznet socket behave the same.
The CPython socket has a custom exception class called
timeout
which I've added as well. There were a few other unrelated function arguments that already had the nametimeout
so pylint started complaining about overwriting from outer scope. I've changed those arguments to have leading underscores.I tested this change succesfully using an Ethernet Featherwing with a Feather ESP32-S3 TFT
8.2.0-beta.0
I tested with simpletest, simpleserver, and aio_post examples from this repo, the ethernet adafruitio example in the MiniMQTT library, as well as the new HTTPServer example added and explained below.