Skip to content

Commit

Permalink
Handle connection error in mqttsimple client
Browse files Browse the repository at this point in the history
  • Loading branch information
embhorn committed Nov 11, 2024
1 parent 6db6c74 commit 7af0188
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/mqttsimple/mqttsimple.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static int mqtt_net_read(void *context, byte* buf, int buf_len, int timeout_ms)
/* Loop until buf_len has been read, error or timeout */
while (bytes < buf_len) {
rc = (int)recv(*pSockFd, &buf[bytes], buf_len - bytes, 0);
if (rc < 0) {
if (rc <= 0) {
rc = socket_get_error(*pSockFd);
if (rc == 0)
break; /* timeout */
Expand Down

0 comments on commit 7af0188

Please sign in to comment.