Skip to content

Commit

Permalink
Merge pull request #407 from embhorn/gh406
Browse files Browse the repository at this point in the history
Handle connection error in mqttsimple client
  • Loading branch information
philljj authored Nov 11, 2024
2 parents 6db6c74 + 7af0188 commit d5b9743
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 d5b9743

Please sign in to comment.