You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found another issue while working on the arduino-mqtt library.
It looks like that errors from the read() method in the Network class do not traverse up in the client and set the internal flag to disconnected. This has the effect that clients, that never send any packets and only read from the connection, never change the internal "connected" flag if the underlying connection fails.
A fix would be to set the client to disconnected if any serious errors happen while reading from the underlying connection. That way, a future call to isConnected() would correctly return false.
The text was updated successfully, but these errors were encountered:
I've updated the code that uses read() so that it correctly uses these return values:
-1: connection error, isConnected should then return false
0: zero bytes received within the time available, no connection error
0: the number of bytes received, no connection error
This works on Linux, I'm not sure about the Arduino read() implementation following these requirements properly.
Hi again,
I found another issue while working on the arduino-mqtt library.
It looks like that errors from the
read()
method in the Network class do not traverse up in the client and set the internal flag to disconnected. This has the effect that clients, that never send any packets and only read from the connection, never change the internal "connected" flag if the underlying connection fails.A fix would be to set the client to disconnected if any serious errors happen while reading from the underlying connection. That way, a future call to
isConnected()
would correctly returnfalse
.The text was updated successfully, but these errors were encountered: