-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
handle partial socket send()'s #231
Conversation
The patch you sent me seems to be working well. Thank you so much for your help, you saved my day! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Provided that sendall
doesn't handle EAGAIN
, I think the implementation you have for send_bytes
is perfect for addressing this bug.
|
Updating https://github.com/adafruit/Adafruit_CircuitPython_MLX90393 to 2.3.1 from 2.3.0: > Merge pull request adafruit/Adafruit_CircuitPython_MLX90393#45 from FoamyGuy/reset_sleep_ms Updating https://github.com/adafruit/Adafruit_CircuitPython_MPRLS to 1.2.20 from 1.2.19: > Merge pull request adafruit/Adafruit_CircuitPython_MPRLS#20 from FoamyGuy/type_annotations Updating https://github.com/adafruit/Adafruit_CircuitPython_PCF8575 to 1.0.7 from 1.0.6: > Merge pull request adafruit/Adafruit_CircuitPython_PCF8575#8 from FoamyGuy/value_return_bool Updating https://github.com/adafruit/Adafruit_CircuitPython_VL6180X to 1.4.15 from 1.4.14: > Merge pull request adafruit/Adafruit_CircuitPython_VL6180X#34 from FoamyGuy/min_delay_continuous Updating https://github.com/adafruit/Adafruit_CircuitPython_MiniMQTT to 7.11.0 from 7.10.5: > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#232 from vladak/send_bytes_eagain > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#226 from vladak/connect_session_id > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#229 from manchicken/patch-1 > Merge pull request adafruit/Adafruit_CircuitPython_MiniMQTT#231 from dhalbert/partial-send
The library was using
socket.send()
directly, but not checking the return value to see if all the bytes were sent. So for larger packets, a partial send would go unnoticed. Added_send_bytes()
, which callssend()
until all bytes are sent, and also handlesEAGAIN
. I could have usedsocket.sendall()
, but it doesn't handle EAGAIN.I tested by sending 2900-byte packets to a no-history Adafruit IO test feed. @manchicken, who submitted #230, also tested.