Skip to content
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

SocketWrapper MbedClient read() fixes #896

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

JAndrassy
Copy link
Contributor

@JAndrassy JAndrassy commented Jun 16, 2024

this PR for SocketWrapper's MbedClient fixes crash when invoking read() on stopped client

btw. I am very surprised that read(buff, size) should return -1 if no data are available and 0 if the connection is closed. this is how it is in the documentation and in Ethernet library implementation. and apparently this is how it is in BSD sockets. it is very strange for me.
WiFi101 and Portenta Core's lwipClient return -1 too if no bytes are available
WiFiNINA, WiFiS3, esp8266, esp32 return 0 from read(buff, size) if no data are available

a complete research: https://github.com/Networking-for-Arduino/Arduino-Networking-API/blob/main/ArduinoNetAPILibs.md#clientreadbuff-size-return-value

@JAndrassy JAndrassy force-pushed the mbedclient_read_stopped_crash_fix branch from b94442f to 13947c2 Compare June 16, 2024 16:56
@JAndrassy JAndrassy force-pushed the mbedclient_read_stopped_crash_fix branch from 13947c2 to fab0676 Compare June 16, 2024 16:59
@facchinm facchinm merged commit 14950ea into arduino:main Jun 19, 2024
11 checks passed
@facchinm
Copy link
Member

Merged, thanks!

@JAndrassy JAndrassy deleted the mbedclient_read_stopped_crash_fix branch June 19, 2024 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants